develooper Front page | perl.perl6.users | Postings from July 2021

array of strings!

ToddAndMargo via perl6-users
July 5, 2021 09:13
array of strings!
Message ID:
Hi All,

I am sure yo guys already knew this, but I
discovered something new.  I can constrain an
array to a type.

Array of strings:

 > my Str @x;

 > @x[1] ="abc";

 > @x[0] = 12.3;
Type check failed in assignment to @x; expected Str but got Rat (12.3)
   in block <unit> at <unknown file> line 1


-T Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About