C
C#15mo ago
Ewan

✅ I want to make multiple array variables using a for loop, each with 4 items

But how do i do this?
No description
17 Replies
Ewan
EwanOP15mo ago
say i wanted 10 lines, id like 10 variables: person1 person2 all the way to person10 as arrays but how?
Thinker
Thinker15mo ago
That's not a thing
Ewan
EwanOP15mo ago
WHAT
Thinker
Thinker15mo ago
You'll have to use nested arrays
Ewan
EwanOP15mo ago
could u hint how? im pretty new to C#
Lisa
Lisa15mo ago
An array of arrays basically
Thinker
Thinker15mo ago
string[][]
TheRanger
TheRanger15mo ago
jagged arrays yeah
Ewan
EwanOP15mo ago
uhhh ok ill try i guess
TheRanger
TheRanger15mo ago
or multidimensional array but wait the question is, why?
Thinker
Thinker15mo ago
You can actually pretty easily turn your current code into using nested arrays
TheRanger
TheRanger15mo ago
why are u trying to make multiple array variables and what exactly does the 4 items represent?
Ewan
EwanOP15mo ago
i have an assignment which requires this 4 items are different things i need, and then i need to order all the arrays from highest to lowest using one of the 4 items
TheRanger
TheRanger15mo ago
sounds like you need to define a class, but if the assignment requires you to do what u said, ig there's no other option
Ewan
EwanOP15mo ago
we havent done classes yet tho so it isnt expected welp thanks anyways
TheRanger
TheRanger15mo ago
if they didnt teach you how to define multiple array variables then how do you expect to make one?
Ewan
EwanOP15mo ago
idk catshy figure

Did you find this page helpful?