0

What is the output of this code? var n1; n1 = true; Console.WriteLine(n1);

Why is the answer error?

21st Aug 2018, 10:42 AM
Morapedi Khutwane
Morapedi Khutwane - avatar
1 Answer
+ 7
You must initialize at creation time. This is how it must be coded so C# knows that n1 is to be declared bool. var n1 = true; Console.WriteLine(n1);
30th Aug 2018, 1:49 AM
John Wells
John Wells - avatar