Fixes.
This commit is contained in:
parent
e7c016fae8
commit
945967cdc7
12
README.md
12
README.md
|
|
@ -308,12 +308,12 @@ As in CoffeeScript, you can use `chained comprassions`:
|
||||||
`inline switch` and `switch without expression`:
|
`inline switch` and `switch without expression`:
|
||||||
|
|
||||||
String grade = switch {
|
String grade = switch {
|
||||||
when score < 60: 'F'
|
when score < 60: 'F';
|
||||||
when score < 70: 'D'
|
when score < 70: 'D';
|
||||||
when score < 80: 'C'
|
when score < 80: 'C';
|
||||||
when score < 90: 'B'
|
when score < 90: 'B';
|
||||||
default: 'A'
|
default: 'A';
|
||||||
}
|
};
|
||||||
|
|
||||||
As you see, you can use keyword `when`, it's like `case`, but if the condition is satisfied, `switch` will `break`.
|
As you see, you can use keyword `when`, it's like `case`, but if the condition is satisfied, `switch` will `break`.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user