"And" Statement nested in "If" Statement

Hey all,

I’m new to DesignScript and relatively unfamiliar with code in general, though I’ve been working with Grasshopper and Dynamo for some time now. I’m trying to write an “else if” statement with an embedded “And” statement.

The logic I’m going for is something like below, but obviously my syntax is incorrect, or my logic is flawed. Help please? Thanks in advance!

def FixtureCount(Occ,Num)
return = [Imperative]
if(and(Occ =“B Business”, Num<=50))
elseif(and(Occ=“B Business”, Num>50))
elseif(blah blah blah, continue in same fashion)
return = other values;

You logic can be structured a bit easier - no need to utilize an imperitive code here.
Try this in a code block:

Occ == “B Business” && Num <= 50?
Occ == “B Business” && Num > 50?
“continue in same fashion”;

This toilet count automation will usually go a good bit easier if you change your setup to group by use, and set up the rules for the group based on the name. Dictionaries can help a lot too.


Hey Jacob,

Thanks for the response. Your solution worked like a charm. So “?” serves as the “if” portion and the “:” serves as the “else” portion, correct? Trying to learn proper syntax. Tried to upload my script so you could see it in action, but the forum says that new users can’t upload…gotta earn that XP first I guess.

Thanks again,


Correct :slight_smile:

Try uploading your file to dropbox or something and paste the link here :slight_smile: