Functions for Program Structure
While
- Use when you are unsure how may times to repeat a command
- When the program gets to the closing parenthesis of the while statement, it checks the expression given to the while statement, if it is still true, it loops again
If
- Use for an either / or situation
- Note that only one item is executed if true, and an other if false.
- If you have more than one statement to be executed for the true or the false condition, consider a subroutine, or use the progn statement to group several program steps into one.
- Must have a program step to run if the expression is true, if a second item is added, it is executed when the statement is false.