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

Chain a promise

Problem

Start a promise that produces 10. Using .then, chain a follow-up promise that doubles the original result (read it with .result). Await the chained promise and print its value.

Example

The program prints:

20

Solution

See the solution

Course navigation

Quiz — Combining promises   |   Solution: Chain a promise