Difference between revisions of "Larger and Smaller Operators"
From GiderosMobile
Line 2: | Line 2: | ||
'''Supported platforms:''' android, ios, mac, pc<br/> | '''Supported platforms:''' android, ios, mac, pc<br/> | ||
'''Available since:''' Gideros 2017.10<br/> | '''Available since:''' Gideros 2017.10<br/> | ||
− | === Description === | + | === <translate>Description</translate> === |
<translate><br /> | <translate><br /> | ||
Operators to return the larger or smaller of two values.<br /><br /> | Operators to return the larger or smaller of two values.<br /><br /> | ||
Line 8: | Line 8: | ||
a<b> <> </b>b   Compare 'a' and 'b', return the larger of them.<br /> | a<b> <> </b>b   Compare 'a' and 'b', return the larger of them.<br /> | ||
a<b> >< </b>b   Compare 'a' and 'b', return the smaller of them.<br /></translate> | a<b> >< </b>b   Compare 'a' and 'b', return the smaller of them.<br /></translate> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Simple larger examples'''<br/> | '''Simple larger examples'''<br/> | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 28: | Line 28: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Events === | + | === <translate>Events</translate> === |
− | === Constants === | + | === <translate>Constants</translate> === |
|} | |} |
Revision as of 07:28, 24 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2017.10
Description
Operators to return the larger or smaller of two values.
a <> b Compare 'a' and 'b', return the larger of them.
a >< b Compare 'a' and 'b', return the smaller of them.
Examples
Simple larger examples
x=a<>b -- faster than x=math.max(a,b)
x=(x-1)<>5 -- decrement x, but don't go below 5
Simple smaller examples
x=a><b -- faster than x=math.min(a,b)
x=(x+1)><15 -- increment x, but don't go above 15
Make sure x is within bounds example
x=(x<>min)><max
Always return the negative of a number
x=-x><x -- faster than -math.abs
Always return the positive of a number
x=-x<>x -- faster than math.abs
Methods |
EventsConstants |