title: Can¨t find where the issue lie. ERROR: Not all code paths return a value
body: <p>I understand the concept of the error, in some methods etc does not return values, but can't find where the wrongly put code is. I am following a book when learning to write C# code and I have double checked in the book but can't find any help.</p>
  
  <p>I'll paste the code below:
  The error mainly considers the 'public override string ToString(); as a problem area.</p>
  
  <pre><code>using System;
  
  class TidPunkt
  {
      //instansvariabler
      int tim, min, sek;
      bool visaSek = true;
  
      //Metoder
      public void Sätt(int t, int m, int s)
      {
          if (t &lt;= 0 &amp;&amp; t &lt; 24 &amp;&amp; m &lt;= 0 &amp;&amp; m &lt; 60 &amp;&amp; s &lt;= 0 &amp;&amp; s &lt; 60)
          {
              tim = t; min = m; sek = s;
          }
          else
              Console.WriteLine("Wrong input");
      }
      public void SättVisaSek(bool visa)
      {
          visaSek = visa;
  
      }
  
      public int AvläsTim()
      {
          return tim;
      }
      public int AvläsMin()
      {
          return min;
      }
      public int AvläsSek()
      {
          return sek;
      }
      public void Ticka()
      {
          if(++sek == 60)
          {
              sek = 0; ++min;
          }
          if(min == 60)
          {
              min = 0; ++tim;
          }
          if(tim == 24)
          {
              tim = 0;
          }
      }
      public override string ToString()
      {
          string tid = tim + ":" + min;
          if (visaSek)
          {
              tid = tid + ":" + sek;
              return tid;
          }
      }
  
  }
  </code></pre>
  
  <p>Thankful for all feedback and help!
  Thanks!</p>