Day 5.1 Exercise 29 What if

Here’s my work.
Here’s the link to exercise 29.

Ex29 Code
Ex29 Code
Ex29 Output
Ex20 Output


Study Drill.

1. What do you think the if does to the code under it?
If the if statement is true, it will run the code, otherwise it will not run the code.

2. Why does the code under the if need to be indented two spaces?
For readability

3. What happens if it isn’t indented?
Your code will break your computer and explode, and the world will end. Just kidding, nothing will happen, but keep in mind, the next person who reads your code could be your boss, so better start making that habit now.

4. Can you put other boolean expressions from Exercise 27 in the if-statement? Try it.
Done. Line 38-40

5. What happens if you change the initial values for people, cats, and dogs?
The if statement true and false will also change, different codes will run while some doesnt.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s