doc: simplify the `filter/map` example a bit

pull/13529/head
Alexander Medvednikov 2022-02-19 12:10:12 +03:00 committed by GitHub
parent bcc4de19fc
commit 3fa6622ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -1174,10 +1174,8 @@ the `it` built-in variable to achieve a classic `map/filter` functional paradigm
```v
// using filter, map and negatives array slices
a := ['pippo.jpg', '01.bmp', '_v.txt', 'img_02.jpg', 'img_01.JPG']
res := a.filter(it#[-4..].to_lower() == '.jpg').map(fn (w string) string {
return w.to_upper()
})
files := ['pippo.jpg', '01.bmp', '_v.txt', 'img_02.jpg', 'img_01.JPG']
filtered := files.filter(it#[-4..].to_lower() == '.jpg').map(it.to_upper())
// ['PIPPO.JPG', 'IMG_02.JPG', 'IMG_01.JPG']
```