Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

To loop or not to loop?

I have set the values for variables box1 through to box26, how can I display the values of them in the console without writing Console.WriteLine(box1); 26 times?
Hint: Use an array??? :S (That's what they are for)
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
var myArray = new [] { 1, 2, 3, 4, 5 ..., 26 };
foreach (var i in myArray)
Console.WriteLine(i);

Or an for:
for (int i = 0; i < myArray.Length; i++>)
//..

Or you could use reflection or a list or..


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by ohxerxeFeb 4, 2018 03:26 PM 3 304 Feb 4, 2018 03:26 PM
Last Post: matt
[Java] by prodigyhfSep 1, 2017 05:22 PM 0 223 Sep 1, 2017 05:22 PM
Last Post: prodigyhf
[C] by hackaquackAug 1, 2014 03:43 PM 15 348 Aug 1, 2014 03:43 PM
Last Post: Masm4ever