Course of Raku / Essentials / Code blocks / Local variables
Quiz — Local variables
1
What does this program print?
my $value = 100;
{
    my $value = 1;
    $value *= 2;
    say $value;
}
| 2 | Answer: (: 1, 2, 100, 200 :) | A local variable is used and printed. | 
2
What does this program print?
my $value = 100;
{
    my $value = 1;
    $value *= 2;
}
say $value;
| 100 | Answer: (: 1, 2, 100, 200 :) | A local variable is modified, but the global variable is printed. | 
Course navigation
← Code blocks / Global variables | Conditional checks →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська