5
私は次のコードを実行すると:内部セミコロンと外側プロミスオブジェクト
my $timer = Promise.in(2);
my $after = $timer.then({ say "2 seconds are over!"; 'result' });
say $after.result; # 2 seconds are over
# result
を私は
2 seconds are over!
result
が
then
内部
;
の役割は何ですか取得し、なぜ私は
say "2 seconds are over!"; 'result';
を書く場合
次のエラーが発生しますか?
WARNINGS:
Useless use of constant string "result" in sink context (line 1)
2 seconds are over!
及びません。最初の例のような
2 seconds are over!
result
?
' {...} 'は裸のブロックで、サブルーチンに似ています。 –
ありがとうございました – smith