Scratch Loops and If's - Lab set 2
Conditions
In programming, a condition is something that must be true in order for something to happen. A condition is thus said to "evaluate to true" or "evaluate to false." In Scratch, any block whose label says "if," "when," or "until" is a sort of conditional construct.
One such block is:
In programming, a condition is something that must be true in order for something to happen. A condition is thus said to "evaluate to true" or "evaluate to false." In Scratch, any block whose label says "if," "when," or "until" is a sort of conditional construct.
One such block is:
The construct above is generally known as an "if construct." With it can we instruct a sprite to say hello only if, say, the user has depressed the mouse button:
A related construct is the "if-else construct":
With the above construct can we instruct a sprite to say hello or goodbye, depending on whether the user has depressed the mouse button:
Realize that these constructs can be nested to allow, for example, for three different conditions:
The above construct could be called an "if-else if-else construct".
Labs
Complete the following and upload below
1.loops_boxbug_lab_scratch_aplus.doc | |
File Size: | 48 kb |
File Type: | doc |
2.loops_drawingbug_lab_scratch_aplus.doc | |
File Size: | 43 kb |
File Type: | doc |
|
|
|
|