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;
0Promise
0100
125
0True

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.

Course navigation

start and await   |   Chaining and combining