pxt-calliope/docs/courses/csintro/conditionals/overview.md
dkiang 6a215478b0 Variables updates (#473)
* Deleted old images, updated with hand-drawn images

Added new cover image, hand-drawn images.

* Fixed file image path

* Capitalized title

* More additions of original images

* Restored lowercase.

* Replaced traffic light image
2017-08-01 06:55:55 -07:00

32 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Introduction
Computer programs are instructions telling the computer how to process input and deliver output.
An important part of programming is telling the computer WHEN to perform a certain task.
For this, we use something called conditionals. Conditionals get their name because a certain Condition or Rule has to be met.
Students are all already familiar with the concept of conditionals in their daily lives!
Have they ever had their parents say..?
* “If you clean your room, you can go out with your friends.”
* “If your homework is done, you can play video games.”
* “If you do your chores all week, you get your allowance, else you are grounded.”
These are all conditionals! Conditionals follow the format of IF this, THEN that.
>**IF** (condition is met), **THEN** (action performed)
Have the students share a few conditionals from their own lives with the class or within small groups.
Note: For older students, you can have them add the ELSE portion of a conditional.
>**IF** (condition is met), **THEN** (action performed), **ELSE** (different action performed)
Example:
* IF it is snowing, THEN wear boots, ELSE wear shoes.
The ELSE portion makes sure that a different action is performed in either case. Without the ELSE action, your students might be barefoot!
![If-Then workflow](/static/courses/csintro/conditionals/flowchart.PNG)
Tell the students that they will be acting out some conditionals as though the whole class is a computer program for a game. Each student will perform a described action if the indicated condition is met.
**Note:** This activity can be done as a whole class or in smaller groups or as a pencil and paper activity.