-
Senior Member
comparitive operation a/s question
I know this can be done with if(), but is there not an operation which can do this.
I am checking between 2 variables and whichever is smallest is assigned to a third.
if (a<=b) {
c = a
} else if (b<a) {
c = b
}
-
That should work!!!
Code:
a = 5;
b = 7;
c = (a<=b) ? a : b;
trace(c);
-
Elvis...who tha f**k is Elvis?
yup yup, just learnt about that one not long ago studying java It's a join of both if and else!
-
Senior Member
thanks very much, knew it could be done, but never would have figured that out by myself.
-
383,890,620 polygons
... and if someone has read the doc ... :
var z = Math.max(x , y);
<olli/>
-
-
Senior Member
yeah rip i think it is...
i wish it would give the highest from any number of values
-
383,890,620 polygons
it is by far:
10000 iterations:
Math.max : 369ms
(a<=b)? : 381ms
<olli/>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|