Skip to content

Commit fbfdd16

Browse files
steshkosarahhaggarty
authored andcommitted
Update when expression example
Text above code example explains that a when expression must be exhaustive and if it isn't a compilation error will occur. However, the code example is a when statement in which else branch can be removed without a compilation error.
1 parent 1017231 commit fbfdd16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/topics/control-flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ If your `when` expression **doesn't** have a subject, you **must** have an `else
187187
The `else` branch is evaluated when none of the other branch conditions are satisfied:
188188

189189
```kotlin
190-
when {
190+
val message = when {
191191
a > b -> "a is greater than b"
192192
a < b -> "a is less than b"
193193
else -> "a is equal to b"

0 commit comments

Comments
 (0)