title: Call value from a method inside Main() function
body: <p>I am trying to call a value from a method called GetInputstring from inside Main() method, and proceed to the next steps.
  I am stuck regards to how I could get the value myInt and move along. </p>
  
  <p><strong>myInt</strong> (where it has two * around) inside Main() is where it gets the errors.</p>
  
  <pre><code>    static void Main(string[] args)
      {
  
          GetInputstring(**myInt**);
  
          if (**myInt** &lt;= 0)
          {
              Write1(**myInt**);
          }
          else
          {
              Write2(**myInt**);
          }
          Console.ReadKey();
      }
  
      public int GetInputstring(int myInt)
      {
          string myInput;
          //int myInt;
  
          Console.Write("Please enter a number: ");
          myInput = Console.ReadLine();
  
          myInt = Int32.Parse(myInput);
          return myInt;            
      }
  
      static void Write1(int myInt)
      {
          while (myInt &lt;= 0)
          {
              Console.WriteLine("{0}", myInt++);
          }
      }
  
      static void Write2(int myInt)
      {
          while (myInt &gt;= 0)
          {
              Console.WriteLine("{0}", myInt--);
          }
      }
  </code></pre>