For/while loop to produce a single list by iterating through

For/while loop to produce a single list by iterating through

bruno3UP3U
Contributor Contributor
473 Views
2 Replies
Message 1 of 3

For/while loop to produce a single list by iterating through

bruno3UP3U
Contributor
Contributor

I am trying to append a specific number of items to an existing list. In the example in the image below the list “a” has one item (0001) and then I append 2 more items (0002 and 0003).

The number of items to append is known but can vary, so I am looking to a way (for / while loop?) that can append that variable number of items and produce one single list.

 

For example, if I have 5 items, I need to create a list that would iterate through the values of 0-4 and produce the list:

0001 [n=0]
0002 [n=1]
0003 [n=2]
0004 [n=3]
0005 [n=4]

 

which would be the result of evaluating

x[0][8]
x[1][8]
x[2][8]
x[3][8]
x[4][8]

(iterating though x[n][8])

All help appreciated. Thanks.

 

dynamo_addtoList.PNG

 

0 Likes
474 Views
2 Replies
Replies (2)
Message 2 of 3

L.Maas
Mentor
Mentor

Not sure if I understand but something like this?

Revit - Dynamo Index.png

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

0 Likes
Message 3 of 3

bruno3UP3U
Contributor
Contributor

Thanks for reaching out. Turns out I was complicating things and I could do what I wanted with a simple string join!

0 Likes