Randy |
Is it possible to string three or more items in an "if" statement that use the "&&" ? I get errors when I do something like this: if (v101==1 && v102==1 && v103==1) { whereas if I did the same thing with "||" it worked if (v101==1 || v102==1 || v103==1) { However, I need the results of using the "&&" so I resorted to a solution like this: if (v101==1 && v102==1) { if (v103==1) { //code } } Is this a severe limitation of AGI or am I miscoding something? |
Joel |
If my understanding of the AGI Specs is correct (and it better be, since I'm coding something that generates compiled code), then it should be perfectly legal to say: if (v100 == 2 && v101 == 3 && v102 == 4) In fact, I just tested that very if-statement in AGI Studio (v.1.35) and it compiled without complaints. I assume that's what you mean when you say you get errors -- compile errors? If that's the case, then the error must be a different problem. |
Randy |
yup, compile errors. It would not let me compile, yet it would let me compile the identical "or" statement. I don't have the computer I used for this project in front of me so I can't tell you the exact error message, I can check that out tonight though. Hmm... weird. |
Joel |
make sure that you didn't type something to the effect of if (v1 == 1 && v2 == 2 && v3 = 3) because that is a syntax error. You can't have v3 = 3 inside an if-statement in AGI (although you can in C) -- the compiler will say "expression syntax error" or something like that. Aside from that, I can't tell you more with what I know right now. The code you're trying to write compiles even in AGI Studio 1.31 (Peter Kelly's last release). |
sonneveld |
check your spaces and make sure none are tabs.. the compiler might not like them. The error msg would be helpful though. - Nick |