Skip to content

Commit c6a7fa9

Browse files
Make switch consistent and add no_run where appropriate (#105)
Co-authored-by: Ethan McCue <[email protected]>
1 parent cf40a9e commit c6a7fa9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/switch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ if (isLeapYear && !bloodMoon && (age > 30 || catName.equals("fred"))) {
1717

1818
But it can be burdensome if all you are doing is checking if some variable has a particular value.
1919

20-
```java
20+
```java,no_run
2121
~void main() {
2222
if (food.equals("apple")) {
2323
IO.println("Red");
2424
}
25-
else if (name.equals("grape")) {
25+
else if (food.equals("grape")) {
2626
IO.println("Purple");
2727
}
2828
else if (food.equals("orange")) {
@@ -36,7 +36,7 @@ else {
3636

3737
For these situations, you can use a `switch`.
3838

39-
```java
39+
```java,no_run
4040
switch (fruit) {
4141
case "apple" -> {
4242
IO.println("Red");

0 commit comments

Comments
 (0)