Expression in grasshopper

unhandled

(Fereshteh Khojasteh) #1

hi everybody, i have a problem for making an expression in gh
i wrote it as below but it does not work:

if((x=1,20,34,45,60),ok,error)


#2

That part isn’t valid. Do you expect that to be true if (x=1) or (x=20) or (x=34) or (x=45) or (x=60)?

And ‘ok’ and ‘error’ must be defined/renamed inputs to the Eval component.


(Fereshteh Khojasteh) #3

thanks i did what you said and it worked


#4

Good. I thought it would be simple to put a few GH components together to do the equivalent (see white group below), but it was more obscure than I thought, esp. because the Int params are required. Even Series and integer slider components!?


num_in_set_2018Mar31a.gh (16.2 KB)

Probably a simpler way?


(qythium) #5

This seems like a simpler way to me :slight_smile:

a = x in (1,20,34,45,60)