+ 2

How to assign many values to only one integer variable in c#?

I wanna put many value on one integer variable and I don’t know how. My ultimate goal is to create a int variable that equals everything between 0 and 20 but not the value of x that can change between 0 and 20. I hope you understand.

20th Jan 2018, 9:21 PM
Justin Renaud
Justin Renaud - avatar
2 Antworten
+ 3
You can't assign multiple values to one int, however you could create and array or list of ints to store the range. This allow you to access each by index in the same variable. Then handle x as required.
20th Jan 2018, 9:41 PM
Sean Furze
Sean Furze - avatar
0
you can't do that. think of a variable as a box you store data in.
31st Mar 2018, 11:16 AM
Khaled Genena
Khaled Genena - avatar