If Else Issues

  • Thread starter Thread starter EvilSimian
  • Start date Start date
E

EvilSimian

Guest
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 to Visual Studio (I may be blaming something here that has nothing to do with it, although I just got a response on Udemy saying he didn't see an issue and it did work on vs2017 when he tried it) 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 in 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.

This was made on version 8.6.1 (build26)


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)

{

Console.WriteLine("Argh!");

}

if (numTemp == 20)

{

Console.WriteLine("Ugh");

}

if (numTemp > 20)

{

Console.WriteLine("AAAHHH!!!");

}



Console.Read();



}

}

}





Thank you in advance

Continue reading...
 
Back
Top