Course of Raku / Advanced / Control flow / Statement prefixes 🆕 / Exercises

Silence a warning

Problem

quietly suppresses warnings, and like do it hands back the value of its block. Declare a name variable without a value, then build a greeting "Hello, " ~ $name ~ "!" inside a quietly block so the “uninitialized value” warning is hidden. Assign the block’s value to $greeting and print it.

Example

The program prints:

Hello, !

Solution

See the solution

Course navigation

Solution: Force eager evaluation   |   Solution: Silence a warning