Is there any way to close of a conditional expression without an else?
Set A to: A = 100 & X > Y ? 20 : 100
This expression produces a "flicker" because there's no way for me to not use the else part, and I have to set it to something.
I actually don't want to do anything on the else part. Is there any technical reason why you have to add else? there doesn't seem to be any expression for "do nothing"
if your variable is a number, it needs to have a value. If it is a String you can take "".
But what do you want to achieve?
If you want variable A to stay the same when the condition is not true, you can put A to the else condition: 100+X > Y ? 20:A
Develop games in your browser. Powerful, performant & highly capable.
I'm not trying to do anything at all at the moment.. Haha... I'm just playing around with expressions.
I just wondered why conditional expressions required an else in the first place. Yeah I know I can set else to self.variable ...
But it just didn't make sense that It would be required, unless there is a technical reason? But i guess it's just Scirra who can answer that.
The only situation in which this would make sense(?) is if you want to save events. I do not know if it would actually make a difference in performance or so. I think Ashley has designated normal conditions for this purpose.
Expressions must return a value. There is no concept of a "no value returned" state in expressions. So the else part of a conditional is mandatory.