Chapter 6-1 IF/ELSE Example (similar to TallTrees exercise in 6-1)
When writing "IF" statements in Alice, you must do the following in order.
-
Write out in Comments (English) what you want the IF/ELSE statement to be and try to use math.
-
Drag the IF/ELSE command
-
up into a method of your choice (aliceLiddel.walkBetweenTrees example below)
-
select the condition to be TRUE
-
you will change the TRUE in step 3
-
-
From the World's functions window,
-
drag the relation operator (==, != , >, <, >=, <=) over the TRUE condition
-
select 0.25 for the "a" and 0.25 for the "b”
-
you will change these numbers in step 4
-
-
Select an Object and click on the function detail (not method details),
-
drag whatever function (not method) you need over the first 0.25
-
change or drag another function or number over the second 0.25
-