0

how come i cant do var z, then do z = x+y

it just doesnt work

17th Dec 2016, 5:28 PM
chorditronix
chorditronix - avatar
5 ответов
+ 4
Did you initialize the other variables or made sure they are not local in unaccessible places?
17th Dec 2016, 5:57 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
yes , you need to initialize the other variables first. after that the output of the variables can be taken in the var z. see below example:- int x = 6; int y = 4; var z = x + y; Console.WriteLine(z);
17th Dec 2016, 6:45 PM
Siddharth Warwatkar
Siddharth Warwatkar - avatar
+ 2
oh, int z = x + y didnt work but var z = x + y does, thanks.
17th Dec 2016, 6:50 PM
chorditronix
chorditronix - avatar
+ 1
i did that but it didnt work
17th Dec 2016, 6:46 PM
chorditronix
chorditronix - avatar
+ 1
please share the little bit of the code...so we can check.
17th Dec 2016, 6:48 PM
Siddharth Warwatkar
Siddharth Warwatkar - avatar