### Re: Force integers in an array?

On 08/06/2018 04:38 PM, ToddAndMargo wrote: Hi All, Is there a way to force all the members of an array to be integers and to error out is a non-integer is written to one of its cells? Many thanks, -T On 08/06/2018 01:40 PM, Benji wrote: > my Int @a = 1, 2, 3; > > @a.push: 'a'; > > # Type

### Re: Force integers in an array?

On 08/06/2018 01:44 PM, Curt Tilmes wrote: On Mon, Aug 6, 2018 at 4:40 PM ToddAndMargo > wrote: Is there a way to force all the members of an array to be integers and to error out is a non-integer is written to one of its cells? Sure, from the

### Re: Force integers in an array?

On 08/06/2018 01:42 PM, Brad Gilbert wrote: my Int @a; @a[0] = '1' Type check failed in assignment to @a; expected Int but got Str ("1") in block at line 1 On Mon, Aug 6, 2018 at 3:39 PM ToddAndMargo wrote: Hi All, Is there a way to force all the members of an array to be integers and

### Re: Force integers in an array?

On Mon, Aug 6, 2018 at 4:40 PM ToddAndMargo wrote: > Is there a way to force all the members of an array > to be integers and to error out is a non-integer > is written to one of its cells? > Sure, from the examples in the docs: https://docs.perl6.org/language/list#Typing my Int @a = 1, 2, 3;

### Re: Force integers in an array?

> my Int @a; > @a[0] = '1' Type check failed in assignment to @a; expected Int but got Str ("1") in block at line 1 On Mon, Aug 6, 2018 at 3:39 PM ToddAndMargo wrote: > > Hi All, > > Is there a way to force all the members of an array > to be integers and to error out is a non-integer > is

### Force integers in an array?

Hi All, Is there a way to force all the members of an array to be integers and to error out is a non-integer is written to one of its cells? Many thanks, -T