doc: fix misleading description of optionals
parent
7f5e3b36bc
commit
d5eafe79bd
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue