Front page | perl.perl6.users |
Postings from April 2018
.sub confusion
Thread Next
From:
ToddAndMargo
Date:
April 30, 2018 13:05
Subject:
.sub confusion
Message ID:
20e2e23e-e101-8b93-ccf3-c05be1d0709b@zoho.com
Hi All,
I am confused.
With this sub:
sub odd( $Num ) { return $Num % 2; }
Why does this work:
if odd $LineNum
{ $PartsStr ~= '<font color="#006600">'; } # Green
else { $PartsStr ~= '<font color="#663366">'; } # Purple
And this one throw an error:
if $LineNum.odd
{ $PartsStr ~= '<font color="#006600">'; } # Green
else { $PartsStr ~= '<font color="#663366">'; } # PurpleNo
No such method 'odd' for invocant of type 'Int'. Did
you mean 'ord'?
What is my misunderstanding?
Many thanks,
-T
Thread Next
-
.sub confusion
by ToddAndMargo