educative.io

Error in content: use of labels goto

I think this is wrong (Use of Labels - goto)

The continue can be very handy when dealing with nested loops. If we replace continue with break in our program above, our output is only:

it works the same way as continue LABEL1

Hi Ran Fang,
break LABEL1 and continue LABEL1 do not work the same way. break LABEL1 breaks out of the labeled loop entirely, while continue LABEL1 jumps to the next iteration of the labeled loop. So the output with break LABEL1 will be :

i is: 0, and j is: 0
i is: 0, and j is: 1
i is: 0, and j is: 2
i is: 0, and j is: 3

I hope this answer will resolve your query. Thank you

1 Like