true
and false
.==
Equality!=
Inequality>
Greater than<
Less than>=
Greater than or equal to<=
Less than or equal to&&
Logical AND||
Logical OR!
Logical Negation (Not)if
statement will execute a block of code if the specified condition is true.else if
can follow an if statement. It can provide an additional condition to check if the if statement condition is false. You can have multiple else if
statements chained together.else
statement executes a block of code if none of the proceeding if
or else if
conditions are true. The else
statement does not require a condition to be specified.Iteration statements repeatedly execute a block of code as long as a specified condition is true. Iteration can also be referred to as looping.
The while
loop will repeatedly execute a block of code as long as the specified condition remains true. While loops are typically used when the number of iterations are not predetermined.
The for
loop executes a block of code a set number of times based on three statements: the initialization, condition, and the final expression, which is some increment/decrement operation.
A loop terminates when it has finished executing its iterations.
A code block associated with a loop is referred to as the loop body.
A sentinel value is a special value used to terminate a loop.