Raku Books / Using Raku / Introduction
How to debug programs
For quick tests, use the compiler in the mode of the REPL (read—eval—
print loop) shell. Just run the raku command1:
$ raku
To exit type 'exit' or '^D'
>With bigger programs, one of the following techniques helps to visualise data:
- The
sayroutine is used as a stand-alone function or as an object method. It works well with both scalar and aggregate data, such as arrays, hashes, or objects:
say $x;
%data.say;- The
WHATand the^namemethods, which give you the information about the object type or class name:
my Int $x;
say $x.WHAT; # (Int)
say $x.^name; # Int- The
ddroutine. This is a Rakudo-specific feature that dumps an object:
my @a = 1..5;
dd @a; # Array @a = [1, 2, 3, 4, 5]1 Before the rename is complete, use the perl6 command
or make an alias.
Course navigation
← Prerequisites | Strings →