title: Float parsing in C#
body: <p>In C# I declared an array of float in main()</p>
  
  <pre><code>float[] notas = new float[8];
  </code></pre>
  
  <p>Called the method and passed the array by reference also in main()</p>
  
  <pre><code>PopulateArray(ref notas);
  </code></pre>
  
  <p>Here's the implementation of the method PopulateArray(ref float[] arr1)</p>
  
  <pre><code>static void PopulateArray(ref float[] arr1)
      {
          bool vakid;
  
          for (int i = 0; i &lt; arr1.Length; i++)
          {
              do
              {
                  do
                  {
                      Console.Write($"Insira nota {i + 1}  ==&gt;");
                      vakid = float.TryParse(Console.ReadLine(), out arr1[i]);
                      if ((arr1[i] &gt; 20.0) || (arr1[i] &lt; 0.0))
                      {
                          Console.Write("\n\n\t\tAs notas só vão de 0 a 20\n\nPrima uma tecla para continuar");
                          Console.ReadKey();
                      }
                      Console.Clear();
  
                  }while (!((arr1[i] &lt;= 20) &amp;&amp; (arr1[i] &gt;= 0)));
  
              } while (!vakid); 
          }
  
  
      }
  </code></pre>
  
  <p>Used two loops, one to assure that the value inputed is between [0, 20] and another to ensure that whatever input is a decimal number (float). Before this implementation, the array <strong>notas</strong> was of <strong>integer</strong> and everything was working just fine, only <strong>integers</strong> were allowed and also in between the interval of [0, 20]. When I decided to change the type of data to <strong>float</strong>, whenever I type a decimal number (i.e. 3.0) it doesn't go through the outter loop, like if I were typing a character other than a number, much in the same way as when I type a letter.
  So how can I type decimal numbers to store in my array? Ty</p>