dust/examples/async_count.ds
2024-06-24 15:07:11 -04:00

20 lines
248 B
Plaintext

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)
}