Review of concepts

Loop

// Basic syntax of a for loop statement:

//    for (initialization; conditionExpression; update) {
//       do something
//    }

for (let counter=0; counter <25; counter++) {
  console.log("Our count is ",counter);
}

// Nested Loop
for (let i=0; i <10; i++) {
  for (let j=0; j < 10; j++) {
    console.log("i:",i," j:",j);
  }
}

Conditional Statements (if else)

// Example of an expression statement
// Always pay attention to how your curly brackets
//    and code are formatted
//    - if you are using P5 Editor, use "tidy code"

// Note "else" and "else if" are optional parts of
//    an expression statement

if (expression) {
	// do something
} else if (expression) {
	// do something else
} else {
	// do something else
}

// Examples of Expression Operators

if (x>12) { console.log("x is greater than 12"); }
if (x>=12) { console.log("x is greater than or equal to 12"); }
if (x<12) { console.log("x is less than 12"); }
if (x<=12) { console.log("x is less than or equal to 12"); } 
if (x==12) { console.log("x is 12"); }

// IMPORTANT
// (x=12) is a very different from (x==12)
// x=12 is an assignment statement. It causes x to equal 12.

Modulo

Modulo is an arithmetic operation that finds the remainder after division of one number by another. It is represented by the % symbol in many programming languages, including JavaScript.

For example:

console.log(7 % 3);  // Output: 1
console.log(8 % 3);  // Output: 2
console.log(9 % 3);  // Output: 0

Modulo is often used in programming for various purposes, such as:

In the context of loops and patterns, modulo can be particularly useful for creating repeating sequences or organizing elements in grids.