Difference between revisions of "Operator Reference"
Jump to navigation
Jump to search
note on integer division
imported>Scrivener07 (Undo revision 41198 by IsharaMeradin (talk)) |
imported>Egocarib (note on integer division) |
||
Line 49: | Line 49: | ||
== Math Operators == | == Math Operators == | ||
+ - * / % | + - * / % | ||
Math operators perform some sort of operation on the two [[Expression Reference|expressions]] it sits between. Papyrus supports assignment, addition, subtraction, multiplication, division, and integer modulus. The minus sign is also used for negation (also known as unary minus). The addition operator can also be used to concatenate ('paste together') strings. If you try to divide by zero or find the remainder of a divide by zero through modulus the result is undefined and the game will spit an error to the log. | Math operators perform some sort of operation on the two [[Expression Reference|expressions]] it sits between. Papyrus supports assignment, addition, subtraction, multiplication, division, and integer modulus. The minus sign is also used for negation (also known as unary minus). The addition operator can also be used to concatenate ('paste together') strings. If you try to divide by zero or find the remainder of a divide by zero through modulus the result is undefined and the game will spit an error to the log. Integer division will return an integer value and discard any remainders. | ||
Examples: | Examples: | ||
Line 60: | Line 60: | ||
; i will get the value of 1 | ; i will get the value of 1 | ||
i = 9 % 4 | i = 9 % 4 | ||
</source> | |||
<br> | |||
<source lang="papyrus"> | |||
; i will get the value of 4 | |||
i = 29 / 6 | |||
</source> | </source> | ||
<br> | <br> |