Name | Description | Syntax | Examples |
if |
Used to create a branch in your program: Code is only executed if a condition is true |
|
|
if/else |
Two way branch: One piece of code is executed if the condition is true, the other if it is false |
|
|
if/elsif/else |
Multi way branch: One piece of code is executed if a condition is true, another if another condition is true, and yet another if both are false |
|
|
loop |
Loops indefinitely (important: use break to step out of the loop) |
|
|
each |
Used to loop over all items in a collection (Array, Hash, ...) |
|
|