dust/examples/async_count.ds

22 lines
256 B
Plaintext
Raw Normal View History

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