This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ch04-getting-stuff-done-i [2017/08/30 23:04] mithat [Arithmetic operators] |
ch04-getting-stuff-done-i [2017/09/27 23:26] (current) mithat |
||
---|---|---|---|
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 ==== | ||
+ | FIXME TODO | ||
==== Logical operators ==== | ==== Logical operators ==== | ||
- | TODO | + | FIXME TODO |
==== The number of operands ==== | ==== The number of operands ==== | ||
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 ===== | ||
Line 178: | Line 181: | ||
Expressions are made of up one or more operations and return a value. | Expressions are made of up one or more operations and return a value. | ||
- | TODO | + | FIXME TODO |
==== Order of precedence ==== | ==== Order of precedence ==== | ||
- | TODO | + | FIXME TODO |
==== Whitespace ==== | ==== Whitespace ==== | ||
- | TODO | + | FIXME TODO |
(Spaces, tabs, and the invisible characters that mark the end of a line. In short, whitespace in Processing (and Java, C++, and C) is interchangeable. In other words, from Processing’s point of view, a space is the same thing as a tab is the same thing as the end of a line.) | (Spaces, tabs, and the invisible characters that mark the end of a line. In short, whitespace in Processing (and Java, C++, and C) is interchangeable. In other words, from Processing’s point of view, a space is the same thing as a tab is the same thing as the end of a line.) | ||