Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming / Promises / Chaining and combining

Quiz — Combining promises

What does the following program print?

my @jobs = (start { 2 }), (start { 3 });
say [*] await @jobs;
05
16
0(2 3)
023

await @jobs returns the results of the two promises in order, (2, 3). The reduce metaoperator [*] multiplies them, giving 6.

Course navigation

Chaining and combining   |   Chain a promise