This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
ch04-getting-stuff-done-i [2017/08/30 23:04] mithat [Arithmetic operators] |
ch04-getting-stuff-done-i [2017/08/30 23:11] mithat [Expressions] |
||
---|---|---|---|
Line 129: | Line 129: | ||
=== Modulus === | === Modulus === | ||
- | The ''%'' operator is used for the modulus operator. Despite appearances, the modulus operator has nothing to do with percentages. The modulus operator operates on two operands that must be (or evaluate to) integer values. The modulus operation produces the //remainder// that results from the division of the two operands | + | The ''%%%%%'' operator is used for the modulus operator. The modulus operator operates on two operands that must be (or evaluate to) integer (not just numeric) values. Despite appearances, this operation has nothing to do with percentages. The operation produces the //remainder// that results from the division of the two operands. |
<code> | <code> | ||
Line 139: | Line 139: | ||
</code> | </code> | ||
- | The result of the above is that ''%%z''%% holds the value 2.((To be pedantic, there is a difference between modulus and remainder, but it only applies to negative numbers. FIXME)) | + | The result of the above is that ''%%z%%'' holds the value 2. ((To be pedantic, there is a difference between modulus and remainder, but it only applies to negative numbers. FIXME)) |
=== Assignment === | === Assignment === | ||
Line 158: | Line 158: | ||
==== Mixing numeric types ==== | ==== Mixing numeric types ==== | ||
+ | TODO | ||
==== Logical operators ==== | ==== Logical operators ==== | ||
Line 173: | Line 174: | ||
Theoretically, it's possible for a language to define an operator with an arbitrary number of operands, but I am not aware of any operators that take more than three operands in Processing. | Theoretically, it's possible for a language to define an operator with an arbitrary number of operands, but I am not aware of any operators that take more than three operands in Processing. | ||
+ | |||
+ | ---------------------------------- | ||
===== Expressions ===== | ===== Expressions ===== |