Hello, Dynamo users!
I have a simple question.
I’d like to sort odd numbers and even numbers in the list. I am trying to use “List.TakeEveryNthItem” node but the list doesn’t work properly. (Null)
That(curvelt height) is a sigle list, I’d like to seperate (0, 2, 4, 6, …) and (1, 3, 5, 7…). How to handle that problem?
Please help me ! I attached my node and the problem list of node.
Thanks all !
if you see how your TakeEvery node is greyed out. that means it didnt recieve all the required parameters. unfortunately, the n param is not by default (2), so you need to specify that.
I solved this problem !
If i want to sort the even number, first of all, i have to made code block 2; and 1;.
Andthen connect 2; code block to n and 1; code block to offset.
Also, you are right, chrisishere. Thanks for your help.
You can use Modulo [%] node for this.
This calculates the remainder for each number in the list divided by 2.
More succinctly:
DSCore.List.TakeEveryNthItem(evens,2,0);
DSCore.List.DropEveryNthItem(odds,2,0);