If Else Trouble

Chase Williams 1 Reputation point

I'm just starting to learn learn C# and have started learning If Else statements. I could have sworn this programming worked but then after an update (I may be blaming something here that has nothing to do with it) to Visual Studio the if's and else's turned pink, they no longer worked, and it told me the "int numTemp = int.Parse(temperature);" line wasn't the correct format.

Hopefully someone can help me figure out what went wrong. There are no else's because I went back to the beginning of the lesson to start over and try to figure it out, but to no prevail.

using System;

namespace Retry
class MainClass
public static void Main(string[] args)
Console.WriteLine("What's the tempurature like?");
string temperature = Console.ReadLine();

        int numTemp = int.Parse(temperature);

        if (numTemp < 20)
        if (numTemp == 20)
        if (numTemp > 20)




Thank you in advance

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,551 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous

    C# is not supported here on QnA. I'd try asking for help in dedicated forums here.


    --please don't forget to Accept as answer if the reply is helpful--

    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.