Helpme! imperative mode

Excuse my English as a translator.
I have a problem when I want to make a routine with if else and elseif.
I want to do the following:

I have three lists “Columns”, “Plates” and “Columns and plates” and at times I have a list either plates or empty columns, for that reason I am using the IsEmpty node to be able to filter it and when I have that case I pass a list now be plates or columns and if I do not have any empty list, let the two lists pass, but when I write the routine in the last lines of code it gives me an error in code block, I don’t know if I am placing the syntansix correctly or my error is something else I would appreciate it if you could give me an answer to this problem, thank you.


tarrajeo v1.dyn (75.5 KB)

Hi Jorge, welcome to the Dynamo forum :wave:
There are minor syntax issues - try this

[Imperative]
{
	if (NoCol == true) {
		return Pla;
		}
	else if (NoPla ==true) {
		return Col;
		}
	else if (NoCol == false && NoPla == false) {
		return ColPla;
		}

};

I would also review the logic - if there are no columns it may return an empty plate list. (Assuming a possibility of two empty lists)

Why not just join the two lists? If a list is empty it is ignored

1 Like