IF node


#1

Hi there,

This feels like a stupid question, but I’m having difficulties with the IF-node…

If the ‘true’ and ‘false’ inputs are lists with different lengths, the output of the node is a list with the length of the shortest input-list:

Capture4

 

 

 

Am I overlooking something, or is this a bug?

 

Thanks in advance


IF node gives empty list
#2

I think it was on purpose for it to lace over the input correctly? Logic.IF from package zebra will do what you want.

2015-09-29_14h04_07

2015-09-29_14h03_27


#3

Or scope.if it seems.

2015-09-29_14h07_22


#4

Or, you could use Design Script

20150930-1


#5

Thanks for your reactions.

ScopeIf does the job, although I’m not sure this is the only difference between If and ScopeIf.

A better description of these two nodes would be helpful I guess, other than ‘Conditional statement’ and ‘Scoped If statement’


#6

Edit:

It seems ScopeIf won’t works for nested lists as True/False input.

I don’t know anything about Design Script, so I’m trying to avoid it, if possible :slight_smile:

 

Here’s what I’m trying to achieve:

If want to create an option for users (preferably via a Boolean node) to choose between two lists (different lengths) with sublists of 6 points:

Capture5

‘If’ works, but it picks the length of the shortest list

‘ScopeIf’ doesn’t work (after 10 seconds of calculations):

Capture6

Logic.If from Zebra (old If-node) seems to work:

Capture7

 


#7

There’s a node it Rhythm for having a choice between two options. It is called Ayuda.ThisOrThat

I use it all of the time when I need to switch what a graph does.

2015-09-30_07h26_01


#8

It would be good if the IF node was updated. I’m not sure what ScopeIf does but it crashes all the time


#9

“ScopeIf” was used for recursions inside custom nodes. (not sure if node recursion is still supported, I haven’t used it in a long time) I guess the team forgot to update it to handle lists, similar to the standard “If” node in version 0.81.

Because “ScopeIf” was meant only for use inside custom nodes, I would refrain for using it in the main graph. You can try the following work-around for using the default “If” node with unequal length input lists and a single Boolean value:

2015-11-02_12-22-52


#10

Why the images aren’t clickable?


#11

#12

much obliged