On 09/11/2018 02:57 AM, JJ Merelo wrote:
perl6 -e 'say "abc".index("z") =:= NilĀ  ?? "False" !! "True"'

-e runs the script from the CL https://github.com/rakudo/rakudo/wiki/Running-rakudo-from-the-command-line
"abc" is on front (but it could be in the same way)
index return Nil if it does not found (more logical than -1) https://docs.perl6.org/routine/index; it's a constant, so you have to use =:= to check for equality. https://docs.perl6.org/routine/=:= ??!! is the ternary operator in Perl 6 https://docs.perl6.org/language/operators#index-entry-operator_ternary-ternary_operator


JJ
PS: ObStackOverflow plug.

Thank you!  And thank you for the home work!  I am slowly
learning.

Reply via email to