Course of Raku / Advanced / Debugging with dd
Dumping variables
Call dd
to see the value and the type of a variable as you would do with say
:
my $var = 42;
dd $var;
This code prints not only the value of the variable, but also the type of the value:
Int $var = 42
It is also possible to dump more complex data structures such as array or hashes:
my @arr = 10, 20, [1, 2, 3], 30;
dd @arr;
# Array @arr = [10, 20, [1, 2, 3], 30]
Notice that the nested array is also clearly visible.
my %hash =
alpha => 'a',
beta => 'b';
dd %hash;
# Hash %hash = {:alpha("a"), :beta("b")}
Course navigation
←
Start
Debugging with dd
|
Debugging with dd
/ Function signatures
→
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська