Nested Variable

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Posts: 19
Joined: Tue May 14, 2013 8:18 pm

Nested Variable

Post by beneee »

Hi All,

Hopefully this is not a duplicate question as i have searched and I have the terminology correct but i am trying to get a nested variable working, here is a crude example of the code that I am attempting to get working.

- Variables -
ActiveTeam = 1
Team1Colour = Red
Team2Colour = Green
Team3Colour = Blue

- Program Output -
Your team Colour = Team(ActiveTeam)Colour

I really hope that makes sense.


User avatar
Matrix Staff
Posts: 14865
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd

Re: Nested Variable

Post by Benj »


It sounds like you maybe need a multi dimensional array.


Would give you two teams each with three colour values.

You would then reference like this.

Red = TeamColours[ActiveTeam][0]
Green = TeamColours[ActiveTeam][1]
Blue = TeamColours[ActiveTeam][2]

Post Reply