'if' statement parse error...?
I'm getting a parse error on an 'if' statement, but I feel like it should work - in fact, i have perfectly fine 'if' statements elsewhere in a larger piece of code i'm working on which work exactly the way i'd expect them to. For some reason, though, an innocent looking 'if' statement in a different part of my code won't compile. To test if i wasn't just missing something, i carefully typed out a simple 'if' in a fresh document, after rebooting the program. Does anyone else get a parse error when running this simple simple thing in miniAudicle? thanks, j ---code---- while (true) { Std.rand2(1,6) => int i; <<<i>>>; if (i > 3) {<<<"true">>>} else {<<<"false">>>}; 1::second => now; }
Jascha Narveson wrote:
Does anyone else get a parse error when running this simple simple thing in miniAudicle?
if (i > 3) {<<<"true">>>} else {<<<"false">>>};
The semi-colons are used incorrectly. Since each of the blocks inside of the braces is a statement, they must be followed by a semi-colon. There also should not be one after the end of the line. So: if (i > 3) {<<<"true">>>;} else {<<<"false">>>;} -Scott
participants (2)
-
Jascha Narveson
-
Scott Wheeler