Variables - PowerPoint PPT Presentation

About This Presentation
Title:

Variables

Description:

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 ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 7
Provided by: Debra193
Category:
Tags: variables

less

Transcript and Presenter's Notes

Title: Variables


1
Variables Chapter 10
2
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)

3
Use of Variables
  • Keep track of Values
  • Counters
  • Number of times something has happened
  • Keep track of Changes
  • Position
  • Color

4
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

5
Example
  • Timer
  • Begin at Specified Time
  • Count down to 0
  • Scorekeeper
  • Begins at zero
  • Increases the score when a player scores a point

6
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.
Write a Comment
User Comments (0)
About PowerShow.com