Курс языка программирования Raku / Основы / Циклы / Постфиксная форма for
Тест: Постфиксный for*
Try to complete the program so that it uses the posftix form of for and prints the following text:
A
A
B
B
C
C
Here is the draft of the code:
| . | |
| { | ␣ |
| . | .say; |
| . | .say; |
| } | ␣ for 'A'..'C'; |
This code is an example of using a code block with the postfix
for. Note that for must appear on the same line as the closing curly brace. If you put it on a new line, the block will be separated from the loop, and you get a compilation error: Missing block. It’s probably better to avoid such practice of using a code block with postfix constructs.Навигация по курсу
← Циклы / Переменная темы | 💪 Упражнения: Циклы →
Эта страница автоматически переведена с помощью ChatGPT 4o. Оригинальный текст на английском языке.
Переводы этой страницы: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська