docs: make the users.sort example directly runnable
parent
02db94c4bc
commit
28d7532fe8
|
@ -614,7 +614,7 @@ numbers.sort(a > b) // 3, 2, 1
|
|||
|
||||
```v
|
||||
struct User { age int name string }
|
||||
mut users := [...]
|
||||
mut users := [User{21, 'Bob'}, User{20, 'Zarkon'}, User{25, 'Alice'}]
|
||||
users.sort(a.age < b.age) // sort by User.age int field
|
||||
users.sort(a.name > b.name) // reverse sort by User.name string field
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue