Page 1 of 1

Nested if-statement

PostPosted: Tue Sep 08, 2009 7:59 pm
by KarateBrot
In the console I want to define a function with a nested if-statement but I noticed: it doesn't work :problem:

I typed it in like this:
scene.my.var = (x) => { if ? { if ? {then} : {else} } : {else} }

But I get an error because the console hates me. Any ideas how to get it to work? :)

Re: Nested if-statement

PostPosted: Tue Sep 08, 2009 8:05 pm
by standardtoaster
You have to do it this way:

Scene.my.var = (x) =>{if ? {true} : {if ? {true} : {false}}}

Do you get it?

Re: Nested if-statement

PostPosted: Tue Sep 08, 2009 8:08 pm
by KarateBrot
aaaalright thanks yeah i think i got it

Re: Nested if-statement

PostPosted: Tue Sep 08, 2009 8:08 pm
by standardtoaster
Great! If you have anymore questions on things like this I can help. :)

Re: Nested if-statement

PostPosted: Tue Sep 08, 2009 8:12 pm
by KarateBrot
thanks :thumbup: