If Else Overview
If allows you to make a choice dependant on almost anything.
It can be used with text, numbers or users choices.
We use if else choices everyday.
If someone nice smiles at you smile back else keep a straight face.
Simple if else
I am so pleased you are happy
If you typed s (or any other letter) the program would print
I am very sorry you are sad today
Note that both print lines are indented (don't start on far left) this means they are only run if the condition above them is met.
Adventure Game If Else
Note if the user had typed using a capital S then it would not have been equal
Quiz Question If Else
(copy and paste to use)
To find out more about print, == or variables