Difference between revisions of "Mutation Operators"
From GiderosMobile
Line 13: | Line 13: | ||
a<b> /= </b>b   Divide 'a' by 'b', result in 'a'.<br /> | a<b> /= </b>b   Divide 'a' by 'b', result in 'a'.<br /> | ||
a<b> %= </b>b   The result of 'a%b' is placed in 'a'.<br /> | a<b> %= </b>b   The result of 'a%b' is placed in 'a'.<br /> | ||
− | a<b> ^= </b>b   The result of 'a^b' is placed in 'a'. ^ is faster than a=math.pow(a,b)<br /></translate> | + | a<b> ^= </b>b   The result of 'a^b' is placed in 'a'. ^ is faster than a=math.pow(a,b)<br /> |
+ | a<b> ^= </b>0.5   The result is faster than a=math.sqrt(a)<br /></translate> | ||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
'''Simple larger example'''<br/> | '''Simple larger example'''<br/> |
Revision as of 04:20, 8 December 2018
Supported platforms:
Available since: Gideros 2017.11
Description
Operators to mutate a value.
a += b Add 'b' to 'a'.
a -= b Subtract 'b from 'a'.
a *= b Multiply 'a' by 'b', result in 'a'.
a /= b Divide 'a' by 'b', result in 'a'.
a %= b The result of 'a%b' is placed in 'a'.
a ^= b The result of 'a^b' is placed in 'a'. ^ is faster than a=math.pow(a,b)
a ^= 0.5 The result is faster than a=math.sqrt(a)
Examples
Simple larger example
score+=1 -- faster and less typing than score=score+1
Methods |
EventsConstants |