Skip to content

Commit 1ccb4c3

Browse files
authored
doc: minor fixes in examples (#15125)
1 parent a13b8ff commit 1ccb4c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/docs.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,12 +2091,13 @@ Public immutable fields are readonly everywhere.
20912091
V supports anonymous structs: structs that don't have to be declared separately
20922092
with a struct name.
20932093

2094-
```
2094+
```v
20952095
struct Book {
20962096
author struct {
20972097
name string
20982098
age int
20992099
}
2100+
21002101
title string
21012102
}
21022103
@@ -3415,7 +3416,7 @@ import net.http
34153416
34163417
fn f(url string) ?string {
34173418
resp := http.get(url)?
3418-
return resp.text
3419+
return resp.body
34193420
}
34203421
```
34213422

@@ -3430,7 +3431,7 @@ The body of `f` is essentially a condensed version of:
34303431

34313432
```v ignore
34323433
resp := http.get(url) or { return err }
3433-
return resp.text
3434+
return resp.body
34343435
```
34353436

34363437
---
@@ -3474,7 +3475,7 @@ The fourth method is to use `if` unwrapping:
34743475
import net.http
34753476
34763477
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
34783479
} else {
34793480
println(err)
34803481
}

0 commit comments

Comments
 (0)