If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Unit 2: Designing algorithms with conditionals

View my programsTop programs

About this unit

Can computers be objective decision makers? Discover selection as you design algorithms that allow the computer to decide which code to run and when. Learn how to evaluate boolean expressions and construct conditionals to add branching logic to your programs.

What if you only want to do some things some of the time?
You come to a fork in the road: if, elif, else. Which path do you take?
Can you put a conditional inside a conditional?