6. Conditionals in the World Around You


In today's project, you explored the if then block in Scratch and used it to build an interactive graffiti project.

If statements are a type of logic that helps computers make decisions.

Today, you programmed a sprite to make a decision based on whether or not the mouse button was pressed down.

Computer scientists, like you, use if statements all the time in their code.

Any interactive app requires conditionals.

For example, in Angry Birds, if the player touches the screen, then the bird is positioned to launch.

If the player stops touching the screen, then the bird is released.

In Fruit Ninja, if the player swipes a piece of fruit, then the fruit is destroyed.

Many apps and games also have winning conditions.

A winning condition is an if then statement used specifically to tell if someone has won the game.

For example, in Candy Crush, if a player reaches the target score, then they complete the level and win.

In the next CS First Club, you will use more conditionals to make a shadow maker similar to a photo editor you can find on Instagram.

Until then, have fun creating and coding.

  • The song “Venture Out” is © SmartSound-- CC-BY-SA 4.0 does not apply