Skip to content

Commit 1037e33

Browse files
committed
Add README note re: explicit type param on default
1 parent ebb07b3 commit 1037e33

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,14 @@ value is provided. This is done with the `default` method:
269269
val name by parser.storing("-N", "--name", help = "...").default("John Doe")
270270
```
271271

272-
Note that it *is* possible to use `null` for the default:
272+
Note that it *is* possible to use `null` for the default, though this may
273+
require specifying the type parameter for `default` explicitly:
273274

274275
```kotlin
275-
val name by parser.storing("-N", "--name", help = "...").default(null)
276+
val name by parser.storing("-N", "--name", help = "...").default<String?>(null)
276277
```
277278

278-
The resulting value will be nullable (a `String?` in this case).
279+
The type of the resulting property be nullable (a `String?` in this case).
279280

280281

281282
### Adding a Validator

0 commit comments

Comments
 (0)