Condition in dynamo

I have a stupid code like this… have 3 input and check their values. skip the value if it is null and includes the rest… so, are there any better code for this? or in python? thanks!

a=in1;
b=in2;
c=in3;
d=[Imperative]
{
if ((a==null) && (b==null))
	{
	return=c;
	}
elseif ((b==null) && (c==null))
	{
	return=a;
	}
elseif ((a==null) && (c==null))
	{
	return=b;
	}

elseif (a==null)
	{
	return=List.Join([b,c]);
	}
elseif (b==null)
	{
	return=List.Join([a,c]);
	}
elseif (c==null)
	{
	return=List.Join([a,b]);
	}

else
	{
	return=List.Join([a,b,c]);
	}
};

Do you want to filter the null values?

yes, and then use List.Join!

Did you try with List.Clean ?

If the input is null, I want to remove it from the List.Join


Maybe that way

2 Likes

Hi, but I want to completely remove that list, which is list 1 in your image

I found a python script by myself :slight_smile:

1 Like