doc: fix misleading description of optionals

pull/4559/head
dumblob 2020-04-23 05:35:33 +02:00 committed by GitHub
parent 7f5e3b36bc
commit d5eafe79bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1000,12 +1000,12 @@ println(resp.body)
```
`http.get` returns `?http.Response`. It was called with `?`, so the error is propagated to the calling function
(which must return an optional) or in case of `main` leads to a panic.
(which must return an optional) or in case of `main()` leads to a panic.
Basically the code above is a shorter version of
```v
resp := http.get(url) or {
panic(err)
return error(err)
}
println(resp.body)
```
@ -1013,6 +1013,7 @@ println(resp.body)
V does not have a way to force unwrap an optional (like Rust's `unwrap()`
or Swift's `!`). You have to use `or { panic(err) }` instead.
## Generics
```v