if and else

Programming for ML with no experience — if you can type, you can begin

Every program you have written so far runs every single line, every time, top to bottom, no exceptions. That is fine until it isn't: sometimes one line should run only when something is true right now, and something different should happen when it isn't. Until this lesson you had no way to say that.

🔒 This is a Pro lesson — the interactive figure, worked examples, quiz and practice open with Pro access.

▶ if and else
← True or False: Booleans & Comparisonselif & Combining Conditions →