@@ -609,9 +609,10 @@ Returns the given item to the enclosing C<gather> block, without introducing a n
609
609
610
610
method so()
611
611
612
- Returns a C < Bool > value representing the result of negating (with implicit
613
- conversion to C < Bool > ) the expression and then again computing the negation of
614
- the result, thus computing the C < Bool > equivalent to the original expression.
612
+ Evaluates the item in boolean context (and thus collapses Junctions),
613
+ and returns the result.
614
+ It is the opposite of C < not > , and equivalent to the
615
+ L « C < ? > operator|/language/operators#prefix_?» .
615
616
616
617
One can use this method similarly to the English sentence: "If that is B < so > ,
617
618
then do this thing". For instance,
@@ -622,27 +623,24 @@ then do this thing". For instance,
622
623
say "Verbose option detected in arguments";
623
624
} # OUTPUT: «Verbose option detected in arguments»
624
625
625
- The C < $verbose-selected > variable in this case contains a
626
- L < C < Junction > |/type/Junction> , whose value is C < any(any(False, False),
627
- any(False, False), any(False, False), any(True, False)) > . That is actually a
628
- I < truish > value; thus, negating it will yield C < False > . The negation of that
629
- result will be C < True > . C < so > is performing all those operations under the hood.
630
-
631
626
= head2 method not
632
627
633
628
method not()
634
629
635
- Returns a C < Bool > value representing the logical negation of an expression.
636
- Thus it is the opposite of C < so > .
630
+ Evaluates the item in boolean context (and thus collapses Junctions),
631
+ and negates the result.
632
+ It is the opposite of C < so > , and equivalent to the
633
+ L « C < ! > operator|/language/operators#prefix_!» .
637
634
638
635
my @args = <-a -e -b>;
639
636
my $verbose-selected = any(@args) eq '-v' | '-V';
640
637
if $verbose-selected.not {
641
638
say "Verbose option not present in arguments";
642
639
} # OUTPUT: «Verbose option not present in arguments»
643
640
644
- Since there is also a prefix version of C < not > , the above code reads better
645
- like so:
641
+ Since there is also a
642
+ L « prefix version of C < not > |/language/operators#prefix_not » ,
643
+ this example reads better as:
646
644
647
645
my @args = <-a -e -b>;
648
646
my $verbose-selected = any(@args) eq '-v' | '-V';
0 commit comments