![]() |
: and ?
Can someone tell me what the commands : and ? do? I have seen them in codes and they aren't documented (pretty sure).
Here is an example from a code I have: this.speed = (this.size==1? 1 : this.size==2? 1.2: 1.5); Thanks a bunch |
?: is a C construct similar to the if statement. Graal doesn't support it as far as I know. Syntax is thus:
(condition) ? (true-statement) : (false-statement) The ?: construct is more compact than the if statements. That code snippet you have there? I'll expand it into if's. if (this.size == 1) { this.speed = 1; } else if (this.size == 2) { this.speed = 1.2; } else { this.speed = 1.5; } |
Thanks! ^_^
|
? and : are supported by graal.
|
Well, I'll be [danned].
|
| All times are GMT +2. The time now is 04:37 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.