Can't call simple function - missing semicolon syntax error

Here is some code I am playing with, but it keeps giving me an error 'Syntax error - missin operator, semicolon or"}" near 2

void setup() {
  size(200, 200);
}

void sum(int a, int b, int c) {
  int total = a + b + c;
  println(total);
}

sum(2, 3, 5);
2 Likes

OK, I fixed this. Incase any others are trying out code from Dan Shiffman’s Learning Processing.

I had to call the sum function within the setup() function call.

4 Likes