1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: use #[] in news_fetcher.v to simplify the code

This commit is contained in:
Delyan Angelov 2022-04-10 11:11:53 +03:00
parent 88c4a64a15
commit 8517b8f8b0
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -30,13 +30,10 @@ fn main() {
println('failed to fetch data from /v0/topstories.json')
return
}
mut ids := json.decode([]int, resp.text) or {
ids := json.decode([]int, resp.text) or {
println('failed to decode topstories.json')
return
}
if ids.len > 10 {
ids = ids[0..10]
}
}#[0..10]
mut fetcher_pool := pool.new_pool_processor(
callback: worker_fetch
)