+ 1
How to use goto function
2 Antworten
+ 2
You can use a goto statement to jump out of a deeply nested set of loops:
for(...) {
while(...) {
for(...) {
if(...) {
// exit nested loop
// if condition is true
goto stop;
}
}
}
}
stop:
// do something
If you used a break statement instead of a goto statement, you'd only exit the innermost loop.
goto statements are generally considered bad style though, so you probably should avoid them
+ 1
Anna pls tell me about how to use goto statement