doc: correct an example

pull/4943/head
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
1 changed files with 2 additions and 2 deletions

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()`