32 lines
580 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Labels are not commonly used, and many developers do not understand how they work. Moreover, their usage makes the control flow harder to follow, which reduces the code's readability.
== Noncompliant Code Example
----
myLabel: {
let x = doSomething();
if (x > 0) {
break myLabel;
}
doSomethingElse();
}
----
== Compliant Solution
----
let x = doSomething();
if (x <= 0) {
doSomethingElse();
}
----
 
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]