Course of Raku / Advanced / Control flow / Phasers / Exercises / The order of ENDs
Solution: The order of ENDs
Here is a possible solution to the task.
Code
END say 'first END';
END say 'second END';
say 'body';🦋 You can find the source code in the file end-order.raku.
Output
body
second END
first ENDComments
Both
ENDphasers run after the main code, sobodyis printed first.Multiple
ENDphasers run last-in, first-out: thesecond END, declared later, runs before thefirst END. This mirrors how clean-up usually has to undo the most recent setup first.