tutorial 1: introduction to logical structures

watch it on YouTube

Notes

Definitions

branching or conditional logic structures
these structures evaluate a specific value and then take different actions based on the result.
in if structures, the evaluating condition is an expression that results in a boolean value.
the switch structure can be used to evaluate a case with multiple (more than 2) outcomes
boolean value
value with only 2 states: true or false.
looping logic structures
these structures evaluate a specific condition and perform a set of actions until the terminal condition is reached or the evaluation of the condition changes.
use for structures for loops with a specified end point
use while structures for loops that depend on the evaluative condition changing--but remember to code in some way of checking or creating that change within your loop or you could hang up your program in an infite loop.
terminal condition
a preset end-point, usually the end of a cycle of iteration (e.g., i<100→when 100 is reached, the loop will stop)