Difference between revisions of "Set"
Jump to navigation
Jump to search
added arithmetic operators
imported>JOG m |
imported>JOG (added arithmetic operators) |
||
Line 1: | Line 1: | ||
Sets a local or global variable to a specified value. This value can be a number or an expression. | Sets a local or global variable to a specified value. This value can be a number or an expression. | ||
'''''Arithmetic Operators:''''' | |||
{|border="1" cellpadding="5" cellspacing="0" | |||
|- | |||
! style="background:#efefef;" | Operator | |||
! style="background:#efefef;" | Description | |||
|- | |||
| <nowiki>+</nowiki> | |||
| plus | |||
|- | |||
| <nowiki> -</nowiki> | |||
| minus | |||
|- | |||
| <nowiki> *</nowiki> | |||
| multiply | |||
|- | |||
| <nowiki> /</nowiki> | |||
| divide (integer variables will be truncated) | |||
|- | |||
| <nowiki> %</nowiki> | |||
| modulus (do integer division and return remainder) | |||
|} | |||
In integer divisions the remainder is truncated at the end of the operation: | |||
''set a to 9/5'' will set a to 1 | |||
''set a to 10*9/5'' will set a to 18 | |||
'''''Examples:''''' | |||
set a to 2 | set a to 2 | ||
set b to a*a | set b to a*a |