title: I use a function with return type double and i want to return nothing (not zero)
body: <p>I use a function with a <strong>double</strong> as return type and I want to return nothing (not zero).</p>
  
  <p>In case of error I want the console to output the error message only (but it won't allow me as it requires value to be returned).</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>class Stos
  {
      public static double[] Sztos;
      public int position = 0;
  
      public Stos(int size)
      {
          Sztos = new double[size];
      }
  
      public void push(double value)
      {
          if (position &lt;= Sztos.Length - 1)
          {
              Sztos[position] = value;
              position++;
          }
          else
          {
              Console.WriteLine("You are trying to insert a value to a stack that is full");
          }
      }
      public double pop()
      {
          if (--position&lt;0)
          {
              Console.WriteLine("There are no elements in Stack");
              //I should return something here but I only want error message
          }
          else
          return Sztos[position];
      }
  
  
  }
  </code></pre>