# Re: [Gmsh] How to work with arrays?

```Hey Ruth,
Thanks for the advice. I figured it out roughly at the same time :)
Excellent, now my amazing geometry works ^^
Greetings,
Aleksejs```
```

On 14.09.2016 16:28, Ruth Vazquez Sabariego wrote:
> Dear Aleksejs,
> The problem is the indexing. You should start at 0.
>
> For i In {0:n-1}
>    ss1[i] = ...   ss2[i] = ...
>    ss3[i] = …
> EndFor
>
>
> Otherwise, the first element of the array won’t be correct.
> From your error msg, seems to be 0.
>
> Regards,
> Ruth
>
> —
> Prof. Ruth V. Sabariego
> KU Leuven
> Dept. Electrical Engineering ESAT/Electa, EnergyVille
> http://www.esat.kuleuven.be/electa
> http://www.energyville.be
>
> Free software: http://gmsh.info | http://getdp.info | http://onelab.info
>
>
>
>
>
>
>
>> On 14 Sep 2016, at 12:05, Aleksejs Fomins <aleksejs.fomins@lspr.swiss
>> <mailto:aleksejs.fomins@lspr.swiss>> wrote:
>>
>> Dear Gmsh,
>> I am trying to make a complicated surface loop
>>
>> surfloop = newreg;  Surface Loop(surfloop_air) = {ss1[], ss2[], ss3[],
>> ss4[], s1, s2, s3, s4, s5};
>>
>> where s* are Plane Surfaces and ss* are arrays of plane surfaces. I generate
>> my surface arrays in a loop
>>
>> For i In {1:n}
>>    ss1[i] = ...
>>    ss2[i] = ...
>>    ss3[i] = ...
>> EndFor
>>
>> I notice that this works if only ss1 is generated inside the loop, as then
>> the index GMSH assigns to it is continuous. Otherwise I get error "Unknown
>> surface 0". However, I can plot any one entry of any array, e.g. ss2[18],
>> and I would see what I expect, so the arrays are correct.
>>
>> Could you please explain to me, what is the correct way to pass all entries
>> of an array?
>>
>> Best regards,
>> Aleksejs
>>
>>
>> _______________________________________________
>> gmsh mailing list
>> gmsh@onelab.info <mailto:gmsh@onelab.info>
>> http://onelab.info/mailman/listinfo/gmsh
>

```
```_______________________________________________
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh
```