Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming / Promises / start and await
Quiz — Promises
What does the following program print?
my $p = start { 100 / 4 };
say await $p;| 0 | Promise |
| 0 | 100 |
| 1 | 25 |
| 0 | True |
start runs the block in the background and returns a
promise. await waits for it and returns the block’s result,
100 / 4, which is 25.