We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf40a9e commit c6a7fa9Copy full SHA for c6a7fa9
src/switch.md
@@ -17,12 +17,12 @@ if (isLeapYear && !bloodMoon && (age > 30 || catName.equals("fred"))) {
17
18
But it can be burdensome if all you are doing is checking if some variable has a particular value.
19
20
-```java
+```java,no_run
21
~void main() {
22
if (food.equals("apple")) {
23
IO.println("Red");
24
}
25
-else if (name.equals("grape")) {
+else if (food.equals("grape")) {
26
IO.println("Purple");
27
28
else if (food.equals("orange")) {
@@ -36,7 +36,7 @@ else {
36
37
For these situations, you can use a `switch`.
38
39
40
switch (fruit) {
41
case "apple" -> {
42
0 commit comments