Course of Raku / Advanced / Control flow

Statement prefixes 🆕

A statement prefix is a keyword placed in front of a statement or block to change how it is run. You have already met one — gather, which collects everything a block hands to take. This section introduces a few more general-purpose prefixes.

With prefixes you can turn a block into an expression that yields a value (do), control whether a list is computed immediately or on demand (eager and lazy), and run code purely for its side effects or with its warnings silenced (sink and quietly).

Topics in this section

Practice

Complete the quizzes that cover the contents of this section.

Exercises

This section contains 3 exercises. Examine all the topics of this section before doing the coding practice.

  1. The value of a do block
  2. Force eager evaluation
  3. Silence a warning

Course navigation

Quiz — gather   |   do and the value of a block