Course of Raku / Essentials / Code blocks / Global variables
Quiz — Global variables
1
What does this program print?
my $value = 100;
{
$value *= 2;
}
say $value;
{
$value = 300;
}
200 | Answer: (: 200 :) |
2
What does this program print?
my $visible = 'Sun';
{
$visible = 'Moon';
{
$visible = 'None';
}
say $visible;
}
None | Answer: (: Sun, Moon, None :) | The same global variable is referred in all blocks. |
Course navigation
← Code blocks / Lexical scope | Code blocks / Local variables →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська