Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 24 lines (14 sloc) 0.43 kb
6085a7a @pmichaud [nqp]: Add postcircumfix:<[ ]>.
pmichaud authored
1 #! nqp
2
3 # check positional subscripting
4
5 plan(7);
6
7 my @l := (1,2,3,4,5);
8
9 say("ok 1 # list assignment didn't barf");
10 say('ok ',@l[1], ' # numeric subscript');
11 say('ok ', @l['2'], ' # string subscript');
12
13 my $idx := 3;
14
15 say('ok ', @l[$idx], ' # variable subscript');
16 say('ok ', @l[$idx + 1], ' # expression in subscript');
17
18 @l[0] := 'ok 6 # string array element';
19 say(@l[0]);
20
21 @l[10] := 'ok 7 # automatic expansion';
22 say(@l[10]);
23
Something went wrong with that request. Please try again.