Hello, in this JavaScript video, I am going to show you loop labels. So we've already looked at some more advanced new features, such as the break and the continue statement, you already know what they are. Usually you play both men with a break statement. But the same principle applies with the continuous statement as an extra task I would recommend implementing it with continue. So first of all, let's quickly create a loop for i equals zero, i less than two class. So nothing new here at the moment, nothing new.
And what I'm going to do is I've got a console log. So we're not going to use the new playbook here for you know, get work in print that I feel Yeah, you have printed zero tonight in If you don't understand any of this, or recommend switching back and having a look at the loops video, okay, so if I put here now for example, that's the label now and is not defined. Well sorry to be out a loop that is weird. Let me working. See the mistake that I made? forgot to put a semicolon instead of a colon.
Okay, so I haven't changed the code at all, or this added a label here and what we can do that if we say The calls are not at for example, what we'll do is we will run a bit of code will break out of here. And not only that, we before the semicolon will say, outside the loop, then the semicolon and just say go to this label. And if we run this as you can see, it breaks and he goes back to this little bit here and he continues running the rest of the code. So that's what you know these labels allow you to do, you can add labels ran here as well if you want. Honestly, I'm the biggest fan, you know labels as they have a tendency to create spaghetti code where the code from from one place to another and it's hard to figure out when error pop up, or foreigners show you so you can make the decision for yourself if you want to use something like a label.
That's it for this video. If you have any questions, feel free to drop me a message and I'll look forward to seeing you in the next tutorial.