We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Can't return PVector
Page Index Toggle Pages: 1
Can't return PVector (Read 160 times)
Can't return PVector
Mar 9th, 2009, 1:44am
 
I know it can be done, I've seen plenty of other functions do it :)  but my code simply errors.  Simple example:

PVector foo(){
 PVector pv = new PVector(1,1,1);
 return pv;
}

And when I execute the sketch:
"Syntax error, maybe missing a semicolon."

However, if I remove the return part, it works fine:
void foo(){
 PVector pv = new PVector(1,1,1);
 //return pv;
}

But of course, that does me no good.  What is going on?  I get that Syntax Error fairly often with on lines of code that have no problem, it usually has something to do with another part of the sketch bugging out.  I'm on Processing 1.0.3

thanks
Re: Can't return PVector
Reply #1 - Mar 9th, 2009, 2:39am
 
Ok, solved it myself:
Appears that if I don't have the setup and draw functions before it, it just plain won't work.  Interesting.
Page Index Toggle Pages: 1