变量范围学习案例

using System;
public class ScopeTest
{
public static int Main()
{
for(int i=0;i<10;i++)
{
Console.WriteLine(i);
} //i goes out of scope here

//u should can be declare a variable named i again,because
//there's no other variable with that name in scope
for(int i=9;i>=0;i--)
{
Console.WriteLine(i);
} //i goes out of scope here
return 0;
}
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus