<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'ERROR: Not all code paths return a vale' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'ERROR: Not all code paths return a vale' posted on the 'C#' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 15:52:42 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 15:52:42 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>ERROR: Not all code paths return a vale</title>
      <link>http://www.programmersheaven.com/mb/csharp/428595/428595/error-not-all-code-paths-return-a-vale/</link>
      <description>the error is CalculateScore, BTW I'm a newbie in C#. this is a method from a game I'm working on. MasterMind. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 public static long CalculateScore(byte chances, long millisec)&lt;br /&gt;
        {&lt;br /&gt;
            int score;&lt;br /&gt;
            byte num1 = chances++;&lt;br /&gt;
            byte num2 = (byte)10;&lt;br /&gt;
            byte num3 = (byte)10;&lt;br /&gt;
            switch (Program.currLevelIndex)&lt;br /&gt;
            {&lt;br /&gt;
                case (byte)7:&lt;br /&gt;
                    num2 = (byte)10;&lt;br /&gt;
                    break;&lt;br /&gt;
                case (byte)11:&lt;br /&gt;
                    num2 = (byte)20;&lt;br /&gt;
                    break;&lt;br /&gt;
                case (byte)15:&lt;br /&gt;
                    num2 = (byte)40;&lt;br /&gt;
                    break;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if ((int)chances &amp;gt;= 1 &amp;amp;&amp;amp; (int)chances &amp;lt;= 3)&lt;br /&gt;
                num1 = (byte)40;&lt;br /&gt;
            else if ((int)chances &amp;gt;= 4 &amp;amp;&amp;amp; (int)chances &amp;lt;= 6)&lt;br /&gt;
                num1 = (byte)20;&lt;br /&gt;
            else if ((int)chances &amp;gt; 7)&lt;br /&gt;
                num1 = (byte)10;&lt;br /&gt;
            if (millisec &amp;gt; 480000L)&lt;br /&gt;
                num3 = (byte)10;&lt;br /&gt;
            else if (millisec &amp;gt;= 240000L &amp;amp;&amp;amp; millisec &amp;lt;= 480000L)&lt;br /&gt;
                num3 = (byte)20;&lt;br /&gt;
            else if (millisec &amp;lt; 240000L)&lt;br /&gt;
                num3 = (byte)40;&lt;br /&gt;
            try&lt;br /&gt;
            {&lt;br /&gt;
                score = Convert.ToInt32((int)num2 * (int)num1 * (int)num3);&lt;br /&gt;
            }&lt;br /&gt;
            catch (Exception ex)&lt;br /&gt;
            {&lt;br /&gt;
                score = 0;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            Console.Clear();&lt;br /&gt;
&lt;br /&gt;
            Console.SetCursorPosition(Program.x, Program.y);&lt;br /&gt;
            Console.Write("Your Score was: " + score);&lt;br /&gt;
        }  &lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/428595/428595/error-not-all-code-paths-return-a-vale/</guid>
      <pubDate>Sat, 26 May 2012 11:35:45 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: ERROR: Not all code paths return a vale</title>
      <link>http://www.programmersheaven.com/mb/csharp/428595/428625/re-error-not-all-code-paths-return-a-vale/#428625</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I must admit that I am unable to fully comprehend your code, since you did not include the Main method, and it looks somewhat scanty. &lt;br /&gt;
&lt;br /&gt;
Looking at the signature of your method i.e.,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;public static long CalculateScore(byte chances, long millisec) &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
it is clear that all paths through the method must return a value of type long.&lt;br /&gt;
&lt;br /&gt;
Please check the code to ensure all if-else, switch-case or other conditional statements always result in the method returning a value of type long.&lt;br /&gt;
&lt;br /&gt;
Hope it helps.&lt;br /&gt;
&lt;br /&gt;
Edward</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/428595/428625/re-error-not-all-code-paths-return-a-vale/#428625</guid>
      <pubDate>Tue, 29 May 2012 15:22:27 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: ERROR: Not all code paths return a vale</title>
      <link>http://www.programmersheaven.com/mb/csharp/428595/428626/re-error-not-all-code-paths-return-a-vale/#428626</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I must admit that I am unable to fully comprehend your code, since you did not include the Main method, and it looks somewhat scanty. &lt;br /&gt;
&lt;br /&gt;
Looking at the signature of your method i.e.,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;public static long CalculateScore(byte chances, long millisec) &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
it is clear that all paths through the method must return a value of type long.&lt;br /&gt;
&lt;br /&gt;
Please check the code to ensure all if-else, switch-case or other conditional statements always result in the method returning a value of type long.&lt;br /&gt;
&lt;br /&gt;
Hope it helps.&lt;br /&gt;
&lt;br /&gt;
Edward</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/428595/428626/re-error-not-all-code-paths-return-a-vale/#428626</guid>
      <pubDate>Tue, 29 May 2012 15:24:18 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: ERROR: Not all code paths return a vale</title>
      <link>http://www.programmersheaven.com/mb/csharp/428595/428627/re-error-not-all-code-paths-return-a-vale/#428627</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I must admit that I am unable to fully comprehend your code, since you did not include the Main method, and it looks somewhat scanty. &lt;br /&gt;
&lt;br /&gt;
Looking at the signature of your method i.e.,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;public static long CalculateScore(byte chances, long millisec) &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
it is clear that all paths through the method must return a value of type long.&lt;br /&gt;
&lt;br /&gt;
Please check the code to ensure all if-else, switch-case or other conditional statements always result in the method returning a value of type long.&lt;br /&gt;
&lt;br /&gt;
Hope it helps.&lt;br /&gt;
&lt;br /&gt;
Edward</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/428595/428627/re-error-not-all-code-paths-return-a-vale/#428627</guid>
      <pubDate>Tue, 29 May 2012 15:28:14 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: ERROR: Not all code paths return a vale</title>
      <link>http://www.programmersheaven.com/mb/csharp/428595/429237/re-error-not-all-code-paths-return-a-vale/#429237</link>
      <description>&lt;a href="http://magnetsoftees.blogspot.com"&gt;&lt;/a&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/428595/429237/re-error-not-all-code-paths-return-a-vale/#429237</guid>
      <pubDate>Fri, 17 Aug 2012 05:18:18 -0700</pubDate>
      <category>C#</category>
    </item>
  </channel>
</rss>