rspec/rules/S128/exceptions.adoc

22 lines
498 B
Plaintext
Raw Normal View History

2020-06-30 10:16:44 +02:00
== Exceptions
This rule is relaxed in the following cases:
2021-02-02 15:02:10 +01:00
2020-06-30 10:16:44 +02:00
----
switch (myVariable) {
case 0: // Empty case used to specify the same behavior for a group of cases.
case 1:
doSomething();
break;
case 2: // Use of return statement
return;
case 3: // Use of throw statement
throw new IllegalStateException();
case 4: // Use of continue statement
continue;
default: // For the last case, use of break statement is optional
doSomethingElse();
}
----