The Essential Guide to Conditional Logic

Most of all, conditional logic is just so much fun – it’s the aspect of programming that allows us to speak to our computer, telling it the conditions for when to do something. Without conditional logic, we’re left with nothing more than useless subroutines.

For example:

if (it’s John’s birthday today) then {
    throw him a surprise party }

And so as you can see, without the if-statement, the plans for the party never get executed.

Another example:

for (John = 16; until John is 65; increase John’s age by 1) {
    John has breakfast;
    John goes to work;
    if (it’s 10:30am) then { have a tea break }