+ 1

How to use goto function

25th Mar 2019, 6:01 AM
Sunny Sharma
Sunny Sharma - avatar
2 Answers
+ 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
25th Mar 2019, 7:05 AM
Anna
Anna - avatar
+ 1
Anna pls tell me about how to use goto statement
25th Mar 2019, 7:13 AM
Sunny Sharma
Sunny Sharma - avatar