Using the index of an array in calculations

Hi all, I’m starting out with Grasshopper, and would appreciate some learning assistance. I want a parametrised array of beams. The beams are all the same length, except the beams on the left and right edges of the array should be longer by a defined overhang. I solved this problem by checking when the start point X component was the same as the origin X component, and then subtracting the overhang, while on the right side checking for the end point being the same X dimension as the calculated number of beams times the span lengths. To me, this is a bit ugly, I would prefer to have used the array indices to check for the beam location and conditionally add the overhangs that way. However, I cannot find how to do this using the tree data structure. I’ve been through all the relevant video tutorials that I can find. Any suggestions?

Array of (23.7 KB)

I’m not so clear on what it is you are trying to achieve, but here are a couple of different options that might work for you.

Array of (12.8 KB)

Thanks Adam, and sorry for the slow response. It was my first posting so the notification of your reply went to junk mail…

It’s not exactly what I was trying to achieve but the method you have used of reversing the list and looking at the zero elements is better, I will rework mine to use this.

I was wondering if there is a method for the more general case of selecting the nth item to alter, where n is a parameter?

Sets | List | List Item and Replace Items