1

How do I declare a 2 digit integer in an array? So I would not have to write it out because I got to have a point system from 1 to 60 that needs to be recorded

int[] strScore = new int[60] {1, 2, 3, /*...,*/ 59, 60};
  • 1
    do you mean `int[] strScore = new int[60] {1, 2, 3, /*...,*/ 59, 60};`? Don't mean to be pedantic, but the array of `int`s instantiated with `string`s makes your example a little confusing – AGB Feb 18 '16 at 04:08
  • hmm sorry to be confusing I am new to programming and just trying to get a concept on arrays, so I am practicing. – Christian Feb 18 '16 at 04:19

1 Answers1

4

If you trying to generate all the numbers between 1 and 60 without declaring them explicitly.

Try:

int[] scores = Enumerable.Range(1, 60).ToArray();
Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
  • Awesome Thanks! Now do I just use a regular If Statement if I am trying to set a range mean the User cannot enter anything less than 1 or more than 60? – Christian Feb 18 '16 at 04:08