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:
parent
88c4a64a15
commit
8517b8f8b0
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user