numbered variable?

Discussion in 'Mac Programming' started by butteryak, May 12, 2011.

  1. macrumors newbie

    Joined:
    May 12, 2011
    #1
    Hey I'm looking to create a numbered incremental variable,

    and be able to use those variables depending on what number is being created in a loop. kinda hard to explain.....but....

    var1 = 123
    var2 = 456
    var3 = 789
    var4 = 012

    x = 1
    repeat
    display var(x) (so that depending on what x is I'd display var1 or var2 or...)
    x=x+1
    end repeat

    is the jist of it does that make sense to anyone? I can't seem to find the answer after a fair amount of digging around.... thanks for your guidance!! for an applescript noob....
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    Use an array.

    If you don't know what an array is, then identify which programming language you're using, and we can give more specific information. I can't tell what the programming language is from what you posted. It might be AppleScript, but I'm just guessing.
     
  3. thread starter macrumors newbie

    Joined:
    May 12, 2011
    #3
    I'm using applescript, yes the above "code" wasn't code per-say, just an outline of what I was looking to do......:)
     
  4. macrumors 603

    Joined:
    Aug 9, 2009
    #4
    In AppleScript, an array is called a list.

    Google search terms like these:
    applescript array tutorial
    applescript list tutorial
    applescript list examples
    applescript arrays
    applescript lists
    Or look up the word "list" in an AppleScript reference book.
     
  5. thread starter macrumors newbie

    Joined:
    May 12, 2011
    #5
    thanks!

    sounds good....I'll take a look....looks like the direction I needed...
    thanks again!
     

Share This Page