Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove some spurious "#->"s and sync a couple comments to say output
  • Loading branch information
skids committed Dec 25, 2015
1 parent 81f6147 commit b385a5d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions doc/Language/control.pod
Expand Up @@ -214,7 +214,7 @@ All the same rules for semicolons and newlines apply, consistently
if 0 { say "no" }
elsif False { say "NO" }
else { say "yes" } ; # -> says "yes"
else { say "yes" } ; # says "yes"
The whole thing either L<slips|/type/Slip> us an empty list (if no blocks
were run) or returns the value produced by the block that did run:
Expand Down Expand Up @@ -242,20 +242,20 @@ the sense of a conditional statement. You cannot use C<else> or C<elsif>
with C<unless> because that ends up getting confusing. Other than those
two differences C<unless> works the same as L<if>:
unless 1 { "1 is false".say } ; #-> does not say anything, since 1 is true
unless 1 "1 is false".say ; #-> syntax error, missing block
unless 0 { "0 is false".say } ; #-> says "0 is false"
unless 1 { "1 is false".say } ; # does not say anything, since 1 is true
unless 1 "1 is false".say ; # syntax error, missing block
unless 0 { "0 is false".say } ; # says "0 is false"
unless 42.say and 1 { 43.say } ; #-> says "42" but does not say "43"
43.say unless 42.say and 0; #-> says "42" and then says "43"
43.say unless 42.say and 1; #-> says "42" but does not say "43"
unless 42.say and 1 { 43.say } ; # says "42" but does not say "43"
43.say unless 42.say and 0; # says "42" and then says "43"
43.say unless 42.say and 1; # says "42" but does not say "43"
$_ = 1; unless 0 { $_.say } ; # -> says "1"
$_ = 1; unless 0 -> $_ { $_.say } ; # -> says "0"
$_ = 1; unless False -> $a { $a.say } ; # -> says "False"
$_ = 1; unless 0 { $_.say } ; # says "1"
$_ = 1; unless 0 -> $_ { $_.say } ; # says "0"
$_ = 1; unless False -> $a { $a.say } ; # says "False"
my $c = 0; say (1, (unless 0 { $c += 42; 2; }), 3, $c); #-> says "1 2 3 42"
my $c = 0; say (1, (unless 1 { $c += 42; 2; }), 3, $c); #-> says "1 3 0"
my $c = 0; say (1, (unless 0 { $c += 42; 2; }), 3, $c); # says "(1 2 3 42)"
my $c = 0; say (1, (unless 1 { $c += 42; 2; }), 3, $c); # says "(1 3 0)"
=head3 X<with, orwith, without|control flow,with orwith without>
Expand Down

0 comments on commit b385a5d

Please sign in to comment.