File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2091,12 +2091,13 @@ Public immutable fields are readonly everywhere.
2091
2091
V supports anonymous structs: structs that don't have to be declared separately
2092
2092
with a struct name.
2093
2093
2094
- ```
2094
+ ``` v
2095
2095
struct Book {
2096
2096
author struct {
2097
2097
name string
2098
2098
age int
2099
2099
}
2100
+
2100
2101
title string
2101
2102
}
2102
2103
@@ -3415,7 +3416,7 @@ import net.http
3415
3416
3416
3417
fn f(url string) ?string {
3417
3418
resp := http.get(url)?
3418
- return resp.text
3419
+ return resp.body
3419
3420
}
3420
3421
```
3421
3422
@@ -3430,7 +3431,7 @@ The body of `f` is essentially a condensed version of:
3430
3431
3431
3432
``` v ignore
3432
3433
resp := http.get(url) or { return err }
3433
- return resp.text
3434
+ return resp.body
3434
3435
```
3435
3436
3436
3437
---
@@ -3474,7 +3475,7 @@ The fourth method is to use `if` unwrapping:
3474
3475
import net.http
3475
3476
3476
3477
if resp := http.get('https://google.com') {
3477
- println(resp.text ) // resp is a http.Response, not an optional
3478
+ println(resp.body ) // resp is a http.Response, not an optional
3478
3479
} else {
3479
3480
println(err)
3480
3481
}
You can’t perform that action at this time.
0 commit comments