Re: I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
On 2020-05-26 16:29, Brad Gilbert wrote: There are various equality operators. 「==」 Tests for numeric equality 「eq」 Tests for string equality 「===」 Tests for value identity 「=:=」 Tests for pointer equality (Note that it looks a bit like 「:=」) 「eqv」 Tests for structure equivalence. The 「==」 and

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
There are various equality operators. 「==」 Tests for numeric equality 「eq」 Tests for string equality 「===」 Tests for value identity 「=:=」 Tests for pointer equality (Note that it looks a bit like 「:=」) 「eqv」 Tests for structure equivalence. The 「==」 and 「eq」 operators are special because they for

Re: I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
On Tue, May 26, 2020 at 4:24 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, How do I turn this: $ raku -e 'my $x="abc"; say $x.index( "q" );' Nil into a test? $ raku -e 'my $x="abc"; if $x.index( "q" ) eq Nil {say "Nil"}else{say "Exis

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
Generally you don't need to test for 「Nil」. You can just test for defined-ness. $ raku -e 'my $x="abc"; with $x.index( "q" ) {say "Exists"} else {say "Nil";}' Also 「Nil」 is not a 「Str」, so why would you use 「eq」? $ raku -e 'Nil.Str' Use of Nil in string context If you really need to

I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
Hi All, How do I turn this: $ raku -e 'my $x="abc"; say $x.index( "q" );' Nil into a test? $ raku -e 'my $x="abc"; if $x.index( "q" ) eq Nil {say "Nil"}else{say "Exists";}' Use of Nil in string context in block at -e line 1 Use of Nil in string context in block at -e line 1 Nil Many