Course of Raku / Objects, I/O, and exceptions / Exceptions / The CATCH phaser / Exercises

Handle and continue

Problem

Loop over the three items ok, bad, and ok. For each one, run a block that prints processed <item>, but does die 'boom' when the item is bad. Put a CATCH phaser inside the block so that a failing item is reported as skipped (<item>): <message> and the loop carries on to the next item instead of stopping.

Example

The program prints:

processed ok
skipped (bad): boom
processed ok

Solution

See the solution

Course navigation

The CATCH phaser   |   Solution: Handle and continue