develooper Front page | perl.perl6.users | Postings from April 2018

odd and even

Thread Next
From:
ToddAndMargo
Date:
April 30, 2018 06:48
Subject:
odd and even
Message ID:
542c1af6-f5a0-771c-201a-169bf3437b28@zoho.com
Hi All,

I know it would only take me 25 seconds to write one,
but do we have an odd and even function build in?


Many thanks,
-T

$ perl6 -e 'my $x=3; say $x.odd;'
No such method 'odd' for invocant of type 'Int'. Did you mean 'ord'?
   in block <unit> at -e line 1

$ perl6 -e 'my $x=3; say $x.even;'
No such method 'even' for invocant of type 'Int'
   in block <unit> at -e line 1

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About