Nested if-statement

About advanced scenes, and the Thyme scripting language used in Algodoo.

Nested if-statement

Postby KarateBrot » Tue Sep 08, 2009 7:59 pm

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? :)
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Nested if-statement

Postby standardtoaster » Tue Sep 08, 2009 8:05 pm

You have to do it this way:

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

Do you get it?
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Nested if-statement

Postby KarateBrot » Tue Sep 08, 2009 8:08 pm

aaaalright thanks yeah i think i got it
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Nested if-statement

Postby standardtoaster » Tue Sep 08, 2009 8:08 pm

Great! If you have anymore questions on things like this I can help. :)
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Nested if-statement

Postby KarateBrot » Tue Sep 08, 2009 8:12 pm

thanks :thumbup:
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron