Variables – Chapter 10
Mutable Variables
A piece of storage that holds a value
(piece of information) while a
program is running
• Name
Unique
Cannot be changed
• Data Type
Can be changed (mutable)
Use of Variables
Keep track of Values
• Counters
• Number of times something has
happened
Keep track of Changes
• Position
• Color
In ALICE
Variable is a property that can be
directly changed using a SET method
Added to the PROPERTIES list
Not directly visible within the ALICE
world
Example
Timer
• Begin at Specified Time
• Count down to 0
Scorekeeper
• Begins at zero
• Increases the score when a player
scores a point
Sample Code
Create a world using the Hopping
Bunny. The bunny should hope for
10 seconds with a timer counting
down from 10 to 0.