Logical statements not working for lists in Imperative code block

Hello Gems,
I am trying to use logical statement in imperial code block, but it doesn’t works for lists, instead it does well with single Integer / double.
Kindly have a look at an example:

Can anyone help in figuring this out?

Thanks,

Regards,
Wajed

When you make ‘x’ variable = list, the statement x > y no longer works.
You’re not comparing an integer > integer, instead you’re comparing list > integer which doesn’t work.

You have to iterate over a list using “for”

I’m not sure if you can use “for” in imperative blocks though?..I’d look at a python node for this

1 Like

If I convert ‘y’ and ‘z’ to list, then too the result is same.
just have a look:

again, if you’re comparing lists you’ll have to iterate over them with a ‘for’ function.

you can’t compare them with a basic operand like > or <

The same thing doesn’t work for python node too:


If I convert ‘y’ & ‘z’ in list then too.

Can you please guide me with an example?

It worked. Thanks @andy.leong

Here’s the code successfully done.
Dynamo logic for list 3

1 Like