-
Notifications
You must be signed in to change notification settings - Fork 1
Math
justinmann edited this page Dec 24, 2017
·
4 revisions
Adding by 1:
x ++
x += 1
x = x + 1
Subtracting by 1:
x --
x -= 1
x = x - 1
For floats you can only:
x = x + 1.0
Not operation:
!true // this is false
!1 < 2 // this is false
!1 // compiler error: not can only be used on bool
Comparison:
1 < 2 // true
1.0 > 2.0 // false
1.0 < 2 // compiler error: left and right value must be the same type
true < false // compiler error: comparison is not support on bool
Boolean Math:
0x0001 or 0x0010 // 0x0011
0x0011 and 0x0010 // 0x0010
0x0101 xor 0x0110 // 0x0011
0x0101 shl 1 // 0x1010
0x0101 shr 1 // 0x0010
not 0x00000010 // 0x11111101