Course of Raku / Advanced / Control flow / Statement prefixes 🆕 / Exercises
The value of a do block
Problem
do works in front of control-flow statements too,
turning them into expressions that yield a value. Use
do if 7 > 5 { 'big' } else { 'small' } to choose a
label, assign it to $label, and print it.
Example
The program prints:
bigSolution
Course navigation
← Quiz — Statement prefixes | Solution: The value of a do block →