Code blocks
Code blocks are fragments of your program enclosed in a pair of curly braces: {
and }
. They group a series of statements that work together as a kind of one big statement. We will see many use cases in the further sections.
{
say 'Hello, World!';
}
The presence of a code block in this program does not add much sense, but code blocks are quite useful in other situations, which we’ll cover very soon.
But first, let us examine the concept of scope.
Topics in this section
Course navigation
← Ranges / Matching against a range | Lexical scope →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська