Nested Conditional Statements3:50 with Alena Holligan
Sometimes we need a conditional that evaluates more than one expression. For example: maybe I want to match a range of numbers like 10 through 1000. We need to do two tests -- is the number greater than or equal to 10 AND is the number less than or equal to 1000? In this video we'll look at how to nest conditional statements.
Have you ever found yourself using the same word to express yourself in conversation? For example:
'Programming is kewl'
'Bungee jumping is kewl'
'My vacation was kewl'
While there is nothing technically WRONG with these sentences, the concept being conveyed is not clear. You could be more descriptive by saying:
'Programming is stimulating'
'Bungee jumping is thrilling'
'My vacation was relaxing'
These sentences give a much clearer description of the concept being conveyed. In the same way, you can get comfortable using equality conditionals and force your code to fit into that syntax, even though you may actually mean identical or even NOT equal. Try to use the expression that most clearly defines what your code should actually be doing.
You need to sign up for Treehouse in order to download course files.Sign up