learning-journal

CF 102

View on GitHub

A situation can be evaluated by comparing the values with:

Comparison operators usually return true or false. Logical operators allows you to compare the results of more than one comparison operator.

Loops

There are three types

  1. For: used when you run code a specific number of times, it is usually a counter
  2. While: used when you dont know if a code should run
  3. Do While: similar to while loop except it will run the statement inside its curlies even if the condition evaluates to false

Lopps are structured as so: LOOP (INITIALIZATION; CONDITION; UPDATE){}`

The operator += adds the new content to the variable after it. Basically, if a variable has been declared, using this operator with the updated value following it will set that variable equal to that update…if that makes sense.

Syntax for the loops:

while(true){ ACTION - (until not true)}

for (this;many;times){ACTION}

With the for loop in terms of steps this is what the cpu is doing:

for (1st; 2nd (if true); update to 4th){then do 3rd}