File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,52 @@ by the final statement in the file when C<$check> is not C<True>.
135
135
= for code
136
136
EVALFILE "foo.raku";
137
137
138
+ = head2 sub repl
139
+ I < Note > : C < repl > was introduced in release 2021.06 of the Rakudo compiler.
140
+
141
+ Defined as:
142
+
143
+ sub repl()
144
+
145
+ Pauses execution and enters a REPL (read-eval-print loop) in the current
146
+ context. This REPL is exactly like the one created when you run C < raku >
147
+ L < without any arguments|Programs/04-running-raku#DESCRIPTION > except that
148
+ you can access/modify the program's current context (such as lexical
149
+ variables).
150
+
151
+ For example, if you run this code:
152
+
153
+ = begin code
154
+ my $name = "Alice";
155
+
156
+ say "Hello, $name";
157
+
158
+ repl();
159
+
160
+ say "Goodbye, $name"
161
+ = end code
162
+
163
+ then you'll get the output C < Hello, Alice > and then enter a REPL session
164
+ (I < before > any output with "goodbye" is printed). Your REPL session could
165
+ go as follows:
166
+
167
+
168
+ = begin code :lang<shell>
169
+ Type 'exit' to leave
170
+ [0] > $name
171
+ Alice
172
+ [1] > $name = "Bob"
173
+ Bob
174
+ [2] > exit
175
+ = end code
176
+
177
+ After exiting the REPL session, Raku will resume running the program;
178
+ during this run, any changes you made in the REPL session will still be
179
+ in effect. Thus, after the session above, you'd get the output
180
+ C < Goodbye, Bob > rather than C < Goodbye, Alice > as you would have without
181
+ the REPL session.
182
+
183
+
138
184
= head2 sub mkdir
139
185
140
186
Defined as:
You can’t perform that action at this time.
0 commit comments