2D Arrays Help. Why to use 2D arrays for 2 ints

Hello,

I have been learning unity & programming with a help of someone. He gave me some exercises to do but I am little confused on a certain task.
First of all I need to tell you what I am making. He gave me a task to make stats for and RPG like game and to see them in the inspector, by using lists, so I can store each players stats.

I have some variables i setup: Examples: CurrentHP, maxHP, name, currentLevel, maxLevel, currentMana, MaxMana…

I am confused beacuse he said to put:

curHp,maxHp 
curMana,maxMana
curXp,maxXP
curLevel, maxLevel, 

into 2D Arrays. But i do now know why I should put them in 2D Arrays.

I don’t know why I should put them into 2D arrays instead of normal arrays. Maybe so we can track where players health is from 0 to max?

Thanks for help,

~Slimenian

Hello,

Someone correct me if I am wrong, but the answer is :

There is no worldwide reason why you should put these variables in 2D Arrays.
The only difference is that instead of accessing each variable with its variable name, you can accessing it through the array, with indexes.
Maybe your guy has coded a way where indexes are more convinient for him.

The best thing to do is asking him directly.

If you always know you’ll have the current value in column 1 and the max value in column 2, then having a n Nx2 array can be convenient. This way if you know the row index of the data you want to retireve (i.e. 2 for XP), then you can easily get the associated data (current or max value in this case).