Documentation for method then

Documentation for method then, assembled from the following types:

class Promise

From Promise

(Promise) method then

method then(Promise:D: &code)

Schedules a piece of code to be run after the invocant has been kept or broken, and returns a new promise for this computation. In other words, creates a chained promise.

my $timer =;
my $after = $timer.then({ say "2 seconds are over!"'result' });
say $after.result;  # 2 seconds are over 
                    # result