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

Posts: 15
Joined: Tue May 14, 2013 8:18 pm
Has thanked: 3 times
Been thanked: 1 time

Nested Variable

Postby beneee » Tue Mar 19, 2019 7:34 pm

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: 14461
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4524 times
Been thanked: 4194 times

Re: Nested Variable

Postby Benj » Wed Mar 20, 2019 10:41 am


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]