学习C#之旅 Goto的用法

昨天写了个C#乘法表,今天使用一下Goto,C#也可以用Goto.

for(int a=1;a<=9;a++)
{
    
for(int b=1;b<=a;b++)
    {
     
goto outfor;
  Console.Write(
"{0}*{1}={2}",a,b,a*b);
    }
  Console.WriteLine();
}
Console.ReadLine();
outfor:
Console.Write(
"outfor");
这样就不需要使用break,一个一个得跳了。呵呵。
posted @ 2009-08-06 09:33  凡酷软件  阅读(1128)  评论(0编辑  收藏  举报