See Original text in context
sub repl()
Pauses execution and enters a REPL (read-eval-print loop) in the current context. This REPL is exactly like the one created when you run raku
without any arguments except that you can access/modify the program's current context (such as lexical variables).
For example, if you run this code:
my = "Alice";say "Hello, $name";repl();say "Goodbye, $name"
then you'll get the output Hello, Alice
and then enter a REPL session (before any output with "goodbye" is printed). Your REPL session could go as follows:
Type 'exit' to leave[0] >Alice[1] > = "Bob"Bob[2] > exit
After exiting the REPL session, Raku will resume running the program; during this run, any changes you made in the REPL session will still be in effect. Thus, after the session above, you'd get the output Goodbye, Bob
rather than Goodbye, Alice
as you would have without the REPL session.