dust/examples/async.ds

34 lines
511 B
Plaintext
Raw Normal View History

2023-11-03 23:39:34 +00:00
(output "This will print first.")
(output "This will print second.")
create_random_numbers = |count| => {
2023-11-04 01:16:55 +00:00
numbers = [];
2023-11-03 23:39:34 +00:00
while (length numbers) < count {
numbers += (random_integer)
}
}
2023-11-04 01:16:55 +00:00
do_a_lot = async {
(create_random_numbers 1000)
(output "Made 1000 numbers")
2023-11-03 23:39:34 +00:00
}
2023-11-04 01:16:55 +00:00
do_some = async {
(create_random_numbers 100)
(output "Made 100 numbers")
}
do_a_little = async {
(create_random_numbers 10)
(output "Made 10 numbers")
2023-11-03 23:39:34 +00:00
}
2023-11-04 01:16:55 +00:00
await {
do_a_lot
do_some
do_a_little
}
2023-11-03 23:39:34 +00:00
(output "This will print last.")