Conditionals are "if ____, then _____" statements. For example, "If you don't do your homework, then you will not have a good grade on your report card."
Computer programmers use these conditional statements to test for specific conditions within their program. For example, in a game, a programmer might create the conditional "If the score is more than 10, then display the 'YOU WIN!' screen."
In this assignment, you will create a program that checks the condition of a variable. Based on that condition, your program will perform different tasks.
This program (see below) has a variable called 'age'. Attached to the variable is a slider. This allows a user to change the variable easily. When the green flag is pressed, the program will check to see if 'age' is greater than 2. If it is, then the program will have the cat say "You don't need diapers."
Remix this program and add the following conditionals:
- If you are older than 2 "you don't need diapers"
- If you are older than 15 "you can drive"
- If you are older than 16 "you can see an R rated movie"
- If you are older than 17 "you can vote"
- If you are older than 20 "you can gamble"
- If you are older than 24 "you can rent a car"
- If you are older than 49 "you can retire"
- If you are younger than 3 "Sorry, you are not old enough for anything yet"
- Add your own conditionals until you have a total of 12