I tried for (i in 0..str) as well but it doesn’t work either. It’s one of those areas where the functionality is a bit different from some other languages.
Also be careful to keep the List.Count()outside of the Imperative block. They don’t play well together as shown in the issue highlighted by @Michael_Kirschner2
Edit: I realised I’m using Dynamo 2.0 instead of 1.3, but I think it should work the same, just with different brackets…? I think the Imperative block hasn’t changed much.
thx you for your help! I worked threw the links, but couldn’t get a result.
I have deleded all packages now.
The function Element.Name() gets not found by Dynamo.
Quick thought : Do you have multiple version of Dynamo installed ? Maybe they are in conflict or what …
Also, in your last screen, you cannot define the same variable multiple times in a CodeBlock outside of a Imperative block. DesignScript is an associative way of programming, meaning that :
a = b + 1;
b = 2;
Will result in a evaluated at 3. Things like a = a+1; are prohibited, that is why loops are limited to Imperative blocks.
While I’m not sure about the other issues, I do notice that you don’t seem to have taken my advise to heart;
In particular, the i in 0..cnt part. for i in collection only works (sort of) if the collection is numbers, but even then it’s a bit weird about it.
See how the outputs change with different specification: