• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Working with Variables

A variable is a name that you assign to a datum. It’s called a variable because what it names can vary. For instance, a variable named myScore may equal 10 now. A moment later, after you’ve scored a point in a game, myScore may equal 11. However, in ActionScript, the variability of variables goes far beyond that: You could assign the same variable first to the number 11, then to the string “foo”, and then to an array of strings and numbers.

You can declare variables using the var keyword, as follows:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint