1
0
dust/examples/async_count.ds

22 lines
256 B
Plaintext
Raw Normal View History

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