Coder, writer, nonconformist 🤘
Ex-SWE @ Facebook 🤩
Sharing experience and notes on building a career, sharpening coding skills and creating great things 🏆
Labels are used together with goto statements (continue in JavaScript case), which encourage really unpredictable coding techniques and thus bad style that should be avoided. Having execution order controlling constructions like if statement and loops must be enough; once you define a loop there's no way to enter this loop skipping the initialization phase, the same is true for an if or else clause. Seeing a label in the source code cannot help you understand what's going on because you could possibly jump to this point from anywhere within the same file, under any circumstances.
On the other hand, the ability to stop the execution of not only an inner loop but also of any of outside ones using break <LABEL> seems much more reasonable at first glance. However, I would assume if you have a need to do that something might be really wrong with the algorithm you use - and it's better to revise it instead of using labeled breaks.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Labels are used together with
goto
statements (continue
in JavaScript case), which encourage really unpredictable coding techniques and thus bad style that should be avoided. Having execution order controlling constructions likeif
statement and loops must be enough; once you define a loop there's no way to enter this loop skipping the initialization phase, the same is true for anif
orelse
clause. Seeing a label in the source code cannot help you understand what's going on because you could possibly jump to this point from anywhere within the same file, under any circumstances.On the other hand, the ability to stop the execution of not only an inner loop but also of any of outside ones using
break <LABEL>
seems much more reasonable at first glance. However, I would assume if you have a need to do that something might be really wrong with the algorithm you use - and it's better to revise it instead of using labeled breaks.