+ 1

Values interpreted as variables

I am coding a calculator, and in its current code has some variables of type "Console.ReadLine ()", and when running the code the values ​​of these variables are interpreted as other variables. why? for example: string a = Convert.ToString(Console.ReadLine()); if (a == wow) Console.WriteLine("WOW"); else Console.WriteLine("wow"); there is an exemple code: https://code.sololearn.com/cDffyb99aNE5/?ref=app

29th Oct 2018, 5:20 PM
Cesar C
Cesar C - avatar
2 Answers
+ 3
if you want to compare variables with string use quoation marks so the compiler know that you're comparing variable with string, not variable with variable a == "wow"
29th Oct 2018, 5:44 PM
Taste
Taste - avatar
0
thanks, I really dont think in this. I was tried to make a new variable and compare, but isn't works too
29th Oct 2018, 5:54 PM
Cesar C
Cesar C - avatar