Re: 1 little sequence problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

>From: =A9koda

>sequence s1
>for i=3D1 to 10 do
> s1[i]=3Di
>end for

>i get error message: variable s1 has not been assigned a value=20

Sequences are dynamic, but you can't subscript something that's not =
already
there.  There are a couple of things you can do:

s1 =3D repeat(0, 10)
for i=3D1 to 10 do
        s1[i]=3Di
end for
-- This is probably the fastest (see performance tips in the Eu docs)

s1 =3D { 0,0,0,0,0,0,0,0,0,0}
for i=3D1 to 10 do
        s1[i]=3Di
end for
or:
sequence s1
s1 =3D {}
for i=3D1 to 10 do
        s1 &=3D i
end for


Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu