32 lines
392 B
Plaintext
32 lines
392 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
function func1() { // Noncompliant - there are two points of exit
|
||
|
if (false) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function func2() { // Noncompliant - there are two points of exit
|
||
|
if (a > 0) {
|
||
|
return 0;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
function func1() {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
function func2() {
|
||
|
}
|
||
|
|
||
|
function func3();
|
||
|
----
|