1 / 6

Variables – Chapter 10

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

evelez
Download Presentation

Variables – Chapter 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.

More Related