Fundamentals of Programming

"Success is the ability to go from one failure to another with no loss of enthusiasm." Winston Churchill

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.

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