C# Variable Scope
class Program{
static void Main(string[] args)
{
int n = 10;
{
int m = 20;
{
int p = 30;
Console.WriteLine("N={0}\nM={1}\nP={2}", n, m, p);
}
// Console.WriteLine("N={0}\nM={1}\nP={2}", n, m, p);
Console.WriteLine("\nN={0}\nM={1}", n, m );
}
//Console.WriteLine("N={0}\nM={1}\nP={2}", n, m, p);
Console.WriteLine("\nN={0}",n);
}
}
No comments:
Post a Comment