1 Reply Latest reply on Jun 27, 2008 12:50 PM by RossRitchey

    Question about variables

    FreddyU Level 1
      Simple question... I think :-)

      What is the difference between saying

      var name = 'Bob';


      name = 'Bob';

      What's the point for adding "var" before defining the variable?

        • 1. Re: Question about variables
          RossRitchey Level 4
          the "var" tells the player that you are defining a new variable. In Actionscript 3 this is required for all new variable declarations, as well as typecasting. In Actionscript 2 this was recommended, but not necessarily required.

          Typically, you use "var name = " to initialize the variable, and then call it just by "name = " later.

          To really truly define it correctly:

          var name:String = "Bob";