On 09/11/2018 07:08 PM, Vadim Belman wrote:
Of course constants!
constant ACONST = pi;
constant $SCONST = "aaa";
Even
constant @a = [1,2,3];
though it doesn't affect the actual array content making '@a = [<a b>]'
possible due to the way '=' works in the array context. But
constant @a = <1 2 3>;
works as expected. I could leave it as a homework for you to find out why! 😜 A
tip which you wouldn't find in the documentation: '=' in array context does
element-by-element assign to the left hand array.
11 вер. 2018 р. о 20:17 ToddAndMargo <toddandma...@zoho.com> написав(ла):
On 09/11/2018 08:11 AM, yary wrote:
"Nil... it's a constant, so you have to use =:= to check for equality."
Constants? I thought we did not have constants! Am I mixing
Perl 5 with Perl 6, again?
Best regards,
Vadim Belman
Hi Vadim,
Grrrr !!!! Foiled by Perl 5 again!
$ p6 'constant Pi= 3.1415; say Pi.perl;'
3.1415
$ p6 'constant Pi= "3.1415"; say Pi.perl;'
"3.1415"
$ p6 'constant Pi= "3.1415"; say "<" ~ Pi ~">";'
<3.1415>
$ p6 'constant Pi= "3.1415"; say Pi / 2;'
1.57075
$ p6 'constant Pi= "3.1415"; say "Pi";'
Pi
$ p6 'constant Pi= "3.1415"; say Pi;'
3.1415
Thank you!
-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~