so
ErrorsCollection

so

Synthesised documentation from type/Mu type/Bool language/operators

From type/Mu

See Original text in context

method so()

Evaluates the item in Boolean context (and thus, for instance, collapses Junctions), and returns the result. It is the opposite of not, and equivalent to the ? operator.

One can use this method similarly to the English sentence: "If that is so, then do this thing". For instance,

my @args = <-a -e -b -v>;
my $verbose-selected = any(@argseq '-v' | '-V';
if $verbose-selected.so {
    say "Verbose option detected in arguments";
} # OUTPUT: «Verbose option detected in arguments␤»

The $verbose-selected variable in this case contains a junctions, whose value is any(any(False, False), any(False, False), any(False, False), any(True, False)). That is actually a truish value; thus, negating it will yield False. The negation of that result will be True. so is performing all those operations under the hood.

From type/Bool

See Original text in context

multi sub prefix:<so>(Mu --> Bool:D)

Coerces its argument to Bool, has looser precedence than prefix:<?> .

From language/operators

See Original text in context

multi sub prefix:<so>(Mu $x --> Bool:D)

Evaluates its argument in Boolean context (and thus collapses Junctions), and returns the result.