ch 4 Logical Structures in Alice

ch 4 Logical Structures in Alice - Logic Structures in...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Logic Structures in Alice An Introduction to Programming with Alice Logic and Control Tiles Logic and Control Tiles Logic and Logic control tiles are located at the bottom of the editor area the Logic and control tiles If/Else Loop While Logic and Control Tiles Logic and Control Tiles If/Else Tile If/Else Tile A blank If/Else tile has a place for a true or false condition, and places for two instructions or sets of instructions. If/Else: Binary Bypass If/Else: Binary Bypass A binary bypass has no instruction after the word Else. If/Else: Binary Choice If/Else: Binary Choice A binary choice has an instruction after the word If and after the word Else. The Loop Tile The Loop Tile The Loop tile is used for simple count controlled loops. The Loop Tile The Loop Tile The complicated view of the Loop tile provides access to the loop control variable, called the index. The Loop Tile The Loop Tile It can then be used inside instruction tiles in the body of the loop. In this example, the height the Cheshire Cat jumps will be equal to the index. The While Tile The While Tile A blank While tile has a place for a true or false condition, and a place for an instruction or set of instructions to be repeated. The While Tile The While Tile The While tile can be used for sentinel loops that are not count­ controlled. Here the loop will continue until the skater is within 3 meters of the flagpole. The While Tile The While Tile The while tile can also be used to build count­controlled loops. ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online