dust/examples/async_count.ds

20 lines
248 B
Plaintext
Raw Normal View History

2024-06-24 19:07:11 +00:00
count_slowly = fn (multiplier: int) {
i = 0
while i < 10 {
sleep_time = i * multiplier;
thread.sleep(sleep_time)
io.write_line(i as str)
i += 1
}
}
async {
count_slowly(50)
count_slowly(100)
count_slowly(200)
count_slowly(250)
}