Skip to content

Commit 0e3ac1f

Browse files
authored
some corrections & clarifications
1 parent 84ac0dc commit 0e3ac1f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

doc/Language/py-nutshell.rakudoc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Raku
3232
put "Hello, world!"
3333

3434
There is also the L<say|/routine/say> keyword, which behaves similarly, but will
35-
call the L<gist|/routine/gist> method of its argument.
35+
call the L<.gist|/routine/gist> method of its argument instead of the C<.Str|/routine/Str> method.
3636

3737
Raku
3838

@@ -64,8 +64,9 @@ matching curly braces are closed.
6464

6565
In Raku, a semicolon signifies the end of a statement.
6666
The semicolon may be omitted if it is the last statement
67-
of a block. The semicolon may also be omitted if there
68-
is a closing curly brace followed by a newline.
67+
of a block (i.e. of a list of statements enclosed in curly braces).
68+
The semicolon may also be omitted after a closing curly brace
69+
followed by a newline.
6970

7071
Python
7172

@@ -81,6 +82,7 @@ Raku
8182
3 + 4;
8283
say 1 +
8384
2;
85+
if True { say 42 }
8486

8587
=head2 Blocks
8688

@@ -123,7 +125,7 @@ initialized or declared and initialized at once.
123125
$foo = 12; # initialize
124126
my $bar = 19; # both at once
125127

126-
Also, as you may have noticed, variables in Raku usually start with sigils --
128+
Also, as you may have noticed, variables in Raku usually start with sigils
127129
symbols indicating the type of their container. Variables starting with a C<$>
128130
hold scalars. Variables starting with an C<@> hold arrays, and variables
129131
starting with a C<%> hold a hash (dict). Sigilless variables, declared with a
@@ -398,20 +400,23 @@ I<Raku>
398400
say "Symbol '$symbol' stands for $element";
399401
}
400402

401-
=head2 Lambdas, functions and subroutines>
403+
=head2 Functions, subroutines and lambdas
402404

403405
Declaring a function (subroutine) with C<def> in Python is accomplished
404406
with C<sub> in Raku.
405407

406408
=begin code :lang<python>
407409
def add(a, b):
408410
return a + b
411+
=end code
409412

413+
=begin code
410414
sub add(\a, \b) {
411415
return a + b
412416
}
413417
=end code
414418

419+
415420
The C<return> is optional; the value of the last expression is used as
416421
the return value:
417422

@@ -431,8 +436,8 @@ sub add($a, $b) {
431436
Python 2 functions can be called with positional arguments
432437
or keyword arguments. These are determined by the caller.
433438
In Python 3, some arguments may be "keyword only".
434-
In Raku, positional and named arguments are determined
435-
by the signature of the routine.
439+
In Raku, each argument is either positional or named,
440+
as determined by the signature of the routine.
436441

437442
Python
438443

0 commit comments

Comments
 (0)