What If, Else

Life is full of tough decisions. If a banana is nice and yellow you better grab it quick, but what if it is green or frozen? Or both?? Meet your new goat friend in the land of snowy mountains to learn about If & Else.

Mountain Goat

If-Else is a very important part of coding. It allows your program to perform different actions in different situations.

For example, the following code makes the goat grab the banana if it’s green, or else let the monkey grab it:

if b.green()

goat.goto b

else

monkey.goto b

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s