# Processing throw syntax error when I define a function

**URL:** <https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041>\
**Category:** Beginners\
**Created:** [October 24, 2021, 12:41pm UTC](https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041 "2021-10-24T12:41:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![isikoromochi](https://avatars.discourse-cdn.com/v4/letter/i/9f8e36/32.png) [@isikoromochi](https://discourse.processing.org/u/isikoromochi)\
**Post date:** [October 24, 2021, 12:41pm UTC](https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041/1 "2021-10-24T12:41:41Z")

</div>

Hi all,  
I can’t define any function because of syntax error.

```auto
void setup(){
  size(1000,1000);
}

line(100,100,200,300);

```

This code throws “Syntax Error - Missing operator, semicolon, or ‘}’ near ‘100’?” at line 5.  
I try separating the function from main tab to another tab,but it doesn’t work.  
I changed the name or type of return value,but I got same error.

version:4  
platform:windows10

I appreciate any help.thanks.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 24, 2021, 12:48pm UTC](https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041/2 "2021-10-24T12:48:45Z")

</div>

You can’t have a line of code (your line() command, no pun intended) outside of any function (as soon as you have a function somewhere)

so surround your line () command with

```auto
void draw () {
   line….
}

```

---

<div class="post-metadata">

**Author:** ![isikoromochi](https://avatars.discourse-cdn.com/v4/letter/i/9f8e36/32.png) [@isikoromochi](https://discourse.processing.org/u/isikoromochi)\
**Post date:** [October 24, 2021, 1:01pm UTC](https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041/3 "2021-10-24T13:01:24Z")

</div>

Chrisir

It works fine! Thank you so much!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 26, 2021, 11:08am UTC](https://discourse.processing.org/t/processing-throw-syntax-error-when-i-define-a-function/33041/4 "2021-10-26T11:08:19Z")

</div>

Of course you can have lines of code before setup() but no commands, just declarations like int i=0;

Also, this looks probably more sharp:

```auto
void draw () {
   background(0); 
   line….
}

```
