Learn Alice in FREE step-by-step lessons.
Unit III: Control Structures

In this lesson, you will use arithmetic operators to move the characters to precise locations, to find totals, and other calculations.
In this chapter, you will learn how to use built-in functions, such as getHeight, to retrieve information about objects in the Alice virtual world. You will use functions in calculations and learn how they can be used to create counters and determine totals. You will also learn how to create your own functions, allowing you to organize code, perform specific calculations, and return information that can be used elsewhere in an Alice program.
Objectives:
- Build arithmetic expressions using functions.
- Use variables, functions, and assign statements.
- Create code to do calculations using multiple variables and steps.
- Write a function to do calculations.
- Create a function to get distance to move next to something
- Use a loop to add numbers uses a running total: total=total + number
Please study the material at each of the links below.
Counter Loops: Using a while loop to count using counter=counter+1- Counter: Using an endless loop to count using counter=counter+1
3 Guys take turns counting: Using a while loop to count using counter=counter+1
Calculate Distance to Move Bunny: Distance to move to be next to something
Calculate Distance to Move Skater: Distance to move to be next to something
Writing functions: Create a function to get distance to move next to something- Loop to add numbers: A loop to add numbers uses a running total: total=total + number
- Loop to add numbers and find smallest and largest: The first value is the smallest and largest so far.
Self-Study Questions: What have you learned?
Discussion questions: What do you think?
Glossary for Calculations and Functions
Full Glossary