1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: correct an example

This commit is contained in:
yuyi 2020-05-18 20:35:51 +08:00 committed by GitHub
parent ae3df002a2
commit ebdfe9a9c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1199,7 +1199,7 @@ You can also propagate errors:
```v
resp := http.get(url)?
println(resp.body)
println(resp.text)
```
`http.get` returns `?http.Response`. Because it was called with `?`, the error will be propagated to the calling function
@ -1211,7 +1211,7 @@ The code above is essentially a condensed version of
resp := http.get(url) or {
return error(err)
}
println(resp.body)
println(resp.text)
```
V does not have a way to forcibly "unwrap" an optional (as other languages do, for instance Rust's `unwrap()`