Processing Math
Processing does math pretty much the same way that all modern programming languages do math. Here are some simple rules:
1. BEDMAS rules apply to coded math.
becomes A * B /(C + D)
2. Function parameters can be a mathematical formula.
3. b++ adds one to b. It 'increments' b by 1.
b-- subtracts one from b. It decrements b by 1.
b+=c adds the value of c to b. b+=5 adds five to b.
b-= c subtracts the value of c from b. b-=5 decrements b by 5.
4. Math Symbols
+ is addition
- is subtraction
* is multiplication (shift 8)
/ is division
% is modulus division (yields the remainder)
x = pow(a, 2) is a squared or x * x
x = pow(a, 4) is a to the power of 4 or x * x * x * x.
5. Variable types
int is integer. Integers are whole numbers like 1, 2, 3 etc.
float is numbers with fractional parts like 1.5 or 0.003 etc.
String is letters (or numbers or punctuation or symbols) and can be read in or printed but cannot be used to do math.
6. Help. Choose 'Find in Reference' under Help.