学习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,一个一个得跳了。呵呵。
原文地址:https://www.cnblogs.com/cube/p/1540072.html