Conditionals 101: The Self-Doubt Guide

Conditionals are like conditional statements in programming. But don't worry, it's not as confusing as it sounds.

IF (A == 5) { print("A is equal to 5"); }

ELSE { print("A is not equal to 5"); }

So, let's try an example:

IF (x > 5) { print("x is greater than 5"); }

ELSE { print("x is less than 5"); }

But wait, there's more! You can chain multiple conditionals together:

IF (x > 5) { print("x is greater than 5"); }

IF (x == 10) { print("x is equal to 10"); }

ELSE { print("x is neither greater nor equal to 5 or 10"); }

And that's it! Conditionals are not that hard, are they?

Next up: Loops and Gaming the System