Difference between revisions of "Set"
m
no edit summary
imported>JOG m |
imported>JOG m |
||
Line 25: | Line 25: | ||
'''Notes:''' | |||
set a to 9/5 | When using only numbers in the calculation, you need to use at least one decimal point to tell the game that you want to use floating point division, without a decimal point the remainder is truncated at the end of the division: | ||
set a to | float a | ||
set a to 9/5 ; will set "a" to 1.000 | |||
set a to 9.0/5 ; will set "a" to 1.800 | |||
When your variable is an integer and you want the result to be rounded you need to add 0.5: | |||
short a | |||
set a to 9.0/5+0.5 ; will set "a" to 2 | |||
set a to 9/5+0.5 ; will set "a" to 2 | set a to 7.0/5+0.5 ; will set "a" to 1 | ||
set a to 7/5+0.5 ; will set "a" to 1 | |||