docs: make the users.sort example directly runnable

pull/6665/head
Delyan Angelov 2020-10-21 12:57:58 +03:00
parent 02db94c4bc
commit 28d7532fe8
1 changed files with 1 additions and 1 deletions

View File

@ -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
```