title: How to individually assign a value from console to an array
body: <p>I am making a program that continually prompts the user to input numbers which are then stored in an array until the user provides a given response (E.g "continue"), where the program then displays the array in terminal.</p>
  
  <p>I have been debugging my program and it is setting all values within the array to the last value from console input. </p>
  
  <p>How can I stop the counter from going all the way to the max for that array and instead step through the array 1 by 1 and input a new value from console each time</p>
  
  <pre><code>for (int i = 0; i &lt; inputArray.GetLength(0); i++)
  inputArray[i] = Convert.ToDouble(input);
  goto STARTOVER;
  </code></pre>
  
  <p>Here is my main code:</p>
  
  <pre><code>using System;
  
  namespace Task3
  {
      class MainClass
  {
      public static void Main(string[] args)
      {
          double[] inputArray = new double[40];
  
          Console.WriteLine("Begin");
          while (true)
          {
              STARTOVER:
              var input = Console.ReadLine();
              if (input.Equals("exit", StringComparison.OrdinalIgnoreCase))
              {
                  break;
              }
  
              if (input.Equals("continue",StringComparison.OrdinalIgnoreCase))
              {
                  goto DISPLAY;
              }
  
              else 
              {
                      for (int i = 0; i &lt; inputArray.GetLength(0); i++)
                      inputArray[i] = Convert.ToDouble(input);
                      goto STARTOVER;
              }
  
          }
          DISPLAY:
          for (int i = 0; i &lt; inputArray.GetLength(0); i++)
          {
              Console.Write("{0} ", inputArray[i]);
              Console.WriteLine();
          }
  
      }
  }
  }
  </code></pre>
  
  <p>From my understanding, I shouldn't use goto where possible but I cannot find an alternative to get the program to go back to where "STARTOVER:" is.</p>