Module 01 Β· Swift Basics β Lesson 5 of 5 Β· ~14 min
Making Decisions
if / else
Programs constantly choose between paths. if runs a block of code only when a condition β an expression whose type is Bool β is true. else provides the block to run when it isn't.
Conditions usually come from comparison operators, each producing a Bool:
==equal (two equals signs! a single=assigns)!=not equal<>less / greater than<=>=less / greater than or equal