Summary
In this chapter, we covered control flow, which Perl 6 offers for traditional procedural programming. We talked about executing code blocks and taking decisions using the keywords if
, else
, and elsif
. We also talked about different loops—the basic loop
, for
loops, and the repeat
, until
, and while
loops with pre-conditions or post-conditions. Then we looked at using the gather
—take
pair to collect data and the way Perl 6 works with topics with the help of the given
and when
keywords.
Perl 6 is not just capable of working with the procedural programming style. You will find more information about other paradigms in Chapter 13, Concurrent Programming, Chapter 14, Functional Programming, and Chapter 15, Reactive Programming.
Meanwhile, in the next chapter, we will discuss another level for organizing code and subroutines.