Short-circuit evaluation for "&&" and "||"
7 posts • Page 1 of 1
Short-circuit evaluation for "&&" and "||"
I like Short-circuit evaluation.
I suggest this because the code below returns warning, currently.
I suggest this because the code below returns warning, currently.
- Code: Select all
Scene.my.test = 0;
(Scene.my.test == 0 || 4 / Scene.my.test == 2) ? {} : {}
-- Warning: Failed to evaluate: (Scene.my.test == 0 || 4 / Scene.my.test == 2) ? {} : {}, Division by zero
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Short-circuit evaluation for "&&" and "||"
Is it difficult to implement?
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Short-circuit evaluation for "&&" and "||"
just split it into 2 if-structures
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Short-circuit evaluation for "&&" and "||"
Kilinich wrote:just split it into 2 if-structures
I don't like unnecessary usage of if-structures.
"||" and "'&&" is normally used as short-circuit evaluation, so I expected them to behave same in Thyme.
(c.f. http://en.wikipedia.org/wiki/Short-circuit_evaluation)
In my opinion, it's not bug, so I put this in suggestion forum, but some users can consider this is a bug.
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Short-circuit evaluation for "&&" and "||"
It's the same problem as true ? (1/1) : (1/0) returns error.
I don't think it's worth to care about - no big deal.
I don't think it's worth to care about - no big deal.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Short-circuit evaluation for "&&" and "||"
the true ? (1/1) : (1/0) returns probably a error because you divide by 0 (X/0=impossible)
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-
monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Short-circuit evaluation for "&&" and "||"
monstertje3 wrote:the true ? (1/1) : (1/0) returns probably a error because you divide by 0 (X/0=impossible)
1.8.0 Thyme expression error
He is talking about this.
In my opinion, it's nothing to do with my suggestion.
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests