var: length array

4 views
Skip to first unread message

Ingrid Schockaert

unread,
May 26, 2020, 3:17:41 AM5/26/20
to liam2-users
Dear all

Can anyone tell me how I can programme the following variable correctly:

var: length Array

And could I use subsequently this variable in the following way?

while indx <= var:
    .....


Thank you in advance!
Ingrid


Gaëtan de Menten

unread,
May 27, 2020, 5:21:25 AM5/27/20
to liam2...@googlegroups.com

Hello Ingrid,

 

I am unsure I understand the question. Assuming you want to get the length of an array so that you can loop on all its elements, you can use '__len__()' on it.

Remember indexing is 0-based so you need to start at zero and continue while "< length", and NOT "<= length" !

 

                - length: arr.__len__()

                - idx: 0

                - while idx < length:

                    - show(arr[idx])

                    - idx: idx + 1

 

Hope it helps,

Gaëtan

 

--
You received this message because you are subscribed to the Google Groups "liam2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liam2-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/liam2-users/77a51660-29a6-4863-b30a-6a7ec3b6078a%40googlegroups.com.



Disclaimer: This e-mail may contain confidential information which is intended only for the use of the recipient(s) named above.
If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
Please note that e-mail messages cannot be considered as official information from the Federal Planning Bureau.
Reply all
Reply to author
Forward
0 new messages