Skip to content

Commit 5f81319

Browse files
committed
Document Mu.not
1 parent 2cd5bfe commit 5f81319

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/Type/Mu.pod

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,28 @@ that is B<so>, then do this thing". For instance,
269269
say "Verbose option detected in arguments";
270270
} #-> Verbose option detected in arguments
271271
272+
=head2 method not
273+
274+
method not()
275+
276+
Returns a C<Bool> value representing the logical negation of an expression.
277+
Thus it is the opposite of C<so>.
278+
279+
my @args = <-a -e -b>;
280+
my $verbose-selected = any(@args) eq '-v' | '-V';
281+
if $verbose-selected.not {
282+
say "Verbose option not present in arguments";
283+
} #-> Verbose option not present in arguments
284+
285+
Since there is also a prefix version of C<not>, the above code reads better
286+
like so:
287+
288+
my @args = <-a -e -b>;
289+
my $verbose-selected = any(@args) eq '-v' | '-V';
290+
if not $verbose-selected {
291+
say "Verbose option not present in arguments";
292+
} #-> Verbose option not present in arguments
293+
272294
=end pod
273295

274296
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)