Skip to content

Commit 633c243

Browse files
committed
Document $*0, etc.
Closes #4538
1 parent 79df4f4 commit 633c243

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

doc/Language/REPL.rakudoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,29 @@ The C<REPL> is an interactive Raku prompt. Each line of code you enter in the C<
1010
is executed, and if no output was generated, the value returned
1111
by the expression is output.
1212

13+
=head1 Previous Values
14+
15+
As you enter commands into the REPL, each line has a numeric ID associated with it, starting
16+
with C<0>. On subsequent lines, you can use the result with a special variable only available
17+
in the REPL. C<$*0>, C<$*1>, etc. In this example, we calculate two values and then use them
18+
both on the third line.
19+
20+
=begin code :lang<REPL>
21+
✗ raku
22+
Welcome to Rakudo™ v2025.08.
23+
Implementing the Raku® Programming Language v6.d.
24+
Built on MoarVM version 2025.08.
25+
26+
To exit type 'exit' or '^D'
27+
[0] > 3+2
28+
5
29+
[1] > 7+1
30+
8
31+
[2] > $*0 * $*1
32+
40
33+
[3] >
34+
=end code
35+
1336
=head1 Trap
1437

1538
B<Note>: Running code in the C<REPL> is not equivalent to saving the code in a file and

doc/Type/Pair.rakudoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ For more about format strings, see L<sprintf|/routine/sprintf>.
217217

218218
=head2 method kv
219219

220-
multi method kv(Pair:D: --> List:D)
220+
multi method kv(Pair:D: --> Seq:D)
221221

222-
Returns a two-element L<C<List>|/type/List> with the I<key> and I<value> parts of
222+
Returns a two-element L<C<Seq>|/type/Seq> with the I<key> and I<value> parts of
223223
C<Pair>, in that order. This method is a special case of the same-named
224224
method on L<C<Hash>|/type/Hash>, which returns all its entries as a list of keys and
225225
values.

0 commit comments

Comments
 (0)