lets say i have 2 lists
list1# [1 , 2 , null , null]
list2# [A , B , C , D]
and i want the output to be list1# but replaces nulls from list2# so the output is [1,2,C,D]
is that possible
lets say i have 2 lists
list1# [1 , 2 , null , null]
list2# [A , B , C , D]
and i want the output to be list1# but replaces nulls from list2# so the output is [1,2,C,D]
is that possible
Find indices of nulls from list1 and get values at those indices from list2, replace these values at the same indices in the list1.
ty but iam newb
what nodes to use
You already know what you need to do, try to look up if there are any nodes for it, step by step. that’s how you can learn and develop scripts.
much better!! My brain is wired to use list nodes in all possible cases lol
ty worked
is there a way to change if = 0 instead of null?
All of these options work, but I’ll add another one.
You’re simply asking about a generic conditional statement (an IF statement). You can create your own in a code block very easily. Just follow the standard syntax of:
conditionalTest ? returnIfTrue : returnIfFalse;
For your initial query, you can use this statement:
ListA == null ? ListB : ListA;
(If the value in ListA is null return the value in ListB, else return the value in ListA.)
If you want to do the same thing but with a value of 0, you just update the condition to test for 0 instead of null. You can even combine both conditions and check for values equal to null or 0:
(ListA == null || ListA == 0).