Chapter 4 & 5 Helper Sheet

Making conditions

boolean is a type that holds true and false

You can make conditions for if statements and loops

If / if else / else
if (condition that evaluates to true or false)
{
   // do something
}
else if (condition that evaluates to true or false)  // remember that everything that met first criteria doesn't get here
{
  // do something else
}
.
.  // repeat else if as needed
.
else // remember to put no condition
{
 // do something
}

If facts:
For loop  - repeats when you know the number of times to repeat

for (statement to start the loop; condition that evaluates to true or false; statement to run when the loop repeats)
{
// do something
}

For facts:

While loop - repeats until some condition is met

while (condition that evaluates to true or false)
{
// do something
}