I’m quite new in programming (at all levels). I’m trying to jump from nodes to DesignScript to improve some of my scripts.
I’m getting stuck with a simple for loop (I think, but my level it is what it is) and I don’t get how to get around this.
I’m trying to simplify this definition with for loop:
What I’m trying to do, it’s simplifying that code with a for loop, but there is something that maybe I’m not understanding in the way of getting the results from the for loop.
iListCount = DSCore.List.Count(list1@L2) -1;
result = ;
for (i in 0…iList)
result = (list1[i]<1>) + (list1[i+1…iListCount]);
return = result;
When I finish this code I get an error: Imperative factor not valid.
I didn’t used the flatten here, because I couldn’t get further before getting the result in sublists.
Probably it’s a silly issue that I’m not considering or I haven’t understood correctly in the data list structure.
I hope someone can help me to get across this little rock.
Thank you in advance.