Parentheses (): Used to pass inputs (arguments) into a function.
Semicolon ;: Marks the end of a code statement (like a period in a sentence).
Declared at the top outside functions:
Written before setup().Every function (setup and draw) can use/ update this variable.
Declared inside {}:
Only works inside that specific block {}.
Resets every time the loop runs.(If in draw)
Why put let x at the top?
If let x = 50 is at the top, and set x = width inside setup(), x becomes width when the program starts.
If set x = width inside draw(), x will reset every frame, and your object will not move.
Movement Shortcuts:
x = x + 7 is the same as x += 7 (moves right by 7px).
x++ is the same as x += 1 and x = x + 1 (moves right by 1px).
x -= 1 (moves left).
x *= 2 (moves right much faster).
x /= 2 (slows down and moves left toward 0).
Color Variables:
Yes, a variable can hold a color!Example: let myColor = color(255, 0, 0);
console.log(x):
Prints the value of x in the browser's developer console for debugging.
rectMode(CORNERS): Uses Top-Left $(x1, y1)$ and Bottom-Right $(x2, y2)$ coordinates to draw a rectangle.
Circles: Circles do not have a CORNERS mode because they are drawn from the center by default.
sin(angle) & cos(angle): Both output numbers between $-1$ and $1$.
map(sin(t), -1, 1, 0, 400): Converts the wave value ($-1$ to $1$) into canvas coordinates ($0$ to $400$) to create smooth, oscillating motion.


The Random function —
random(minimum, maximum)
The Map function — eg: map(sin(+), -1, 1, 0, 400)
map(variable, __min Current Range, __max CR, __min New Range, __max NR)
createGraphics()
Boolean — eg: if(MouseX > 10 ){fill(255, 0, 0);}
if( ____ boolean expression(true or false)){ _______ }
true or false: x > 10, x < 10, x ≥ 10, x ≤ 10, x = = 10…etc.
Worksheet 002