goto
C# goto . goto, , . " " , "" . goto . goto . , , , , . , . goto . goto , . goto , , , .
goto C# . , goto, . 1 100 goto .
= 1; loopl: ++;
if( < 100) goto loopl;
, goto case default switch. case default switch . goto. goto switch. , switch. goto switch.
// goto switch.
Using System;
class SwitchGoto { static void Main() {
for(int i=l; i < 5; i++) {
switch(i) { '
case 1:
Console.WriteLine(" case 1"); goto case 3; case 2:
Console.WriteLine(" case 2"); goto case 1; case 3:
Console.WriteLine(" case 3"); goto default; default:
Console.WriteLine(" default"); break;
}
Console.WriteLine();
}
// goto case 1; // ! switch .
}
}
.
case 1 case 3 default
case 2 case 1 case 3 default
case 3 default
default
, goto switch case default. , case break. goto case , "" , , break . , goto switch. , :
|
|
// goto case 1; // ! switch .
. , goto switch, , , ^ .