Slide 1 / 17
Why do we need decisions?
Real programs don't do the same thing every time. They need to react to different situations:
- If the user enters a negative number, show an error
- If the score is above 90, print "A"
- If the username and password match, allow login
Decision statements let your program take different paths depending on conditions.