Course of Raku / Essentials / Loops / for
loops
Understanding the for
loop
For each of the three programs below, tell how many lines they print.
1
for 1..10 {
say 'Line';
}
10 | Your answer: (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 :) |
2
for 1..10 -> $n {
say 'Line';
}
10 | Your answer: (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 :) |
3
for 1..10 -> $a, $b {
say 'Line';
}
5 | Your answer: (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 :) |
Course navigation
← Loops / Infinite loops | Loops / Topic variable →
💪 Or jump directly to the exercises to this section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська