How to break a promise as part of a promise? Perl6 docs do not provide an easy way. For example:
my $x = start { loop { # loop forever until "quit" is seen my $y = prompt("Say something: "); if $y ~~ / quit / { # I want to exit the promise from here; # "break" and "this.break" are not defined; # "return" does not break the promise; # I do NOT want an error exception when exiting a promise; # I want to return a value as the result of this promise; } else { say $y; } } }
I do not want to be in the cycle of promises forever. break() and this.break() not recognized, and return does not break the promise.
promise break perl6
lisprogtor
source share