0
Does var y = 15; not automatically declare y as an int?
Hi, I'm new to C#. The SoloLearn question is: Fill in the blanks to declare two variables of type int and display their sum to the screen. int x = 8; __ y = 15; Console.WriteLine(x _ y); So I know int y = 15 and x + y will work, but using var y = 15 also gives you 23 and wont y then also be declared as an int?
2 Answers
+ 2
It does work but sololearn expects int as answer I think
+ 1
int x = 8;
int y = 15;
Console.WriteLine(x + y);