+ 1
Goto Keyword
In C# we can use the keyword goto, I would like to know how does it really work?
1 Antwort
+ 2
goto is used to move to a line in the code using a label for it.
let's talk with example:
int x=3;
int y=5;
for (int i=1;i <=10;i++)
{
if (i == 5)
goto fiveIsEnough;
Console.Write (i);
}
fiveIsEnough:
Console.write(x + y);
Now the output is -> 12348
where 8 is result of sum x and y