Skip to content

Commit

Permalink
fix: 'Map nullable value if not null' idiom (JetBrains#1483)
Browse files Browse the repository at this point in the history
* 'Map nullable value if not null' idiom fix

* Renamed variable, as suggested

Co-Authored-By: Pavel Semyonov <[email protected]>
  • Loading branch information
Miha-x64 and p7nov committed Oct 25, 2019
1 parent 8647b57 commit a2ae9a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/docs/reference/idioms.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ value?.let {
```kotlin
val value = ...

val mapped = value?.let { transformValue(it) } ?: defaultValueIfValueIsNull
val mapped = value?.let { transformValue(it) } ?: defaultValue
// defaultValue is returned if the value or the transform result is null.
```
</div>

Expand Down

0 comments on commit a2ae9a1

Please sign in to comment.