If Statement Problem

Hi guys,

I want to define two bounds and test whether: x is inside the domain, if its bigger or lower.
Sadly the “Include” component does not tell me whether x is larger or smaller…

Suppose: Domain: 2 to 4.
If x inside domain = 0
If x > 4 = -1
If x < 2 = 1

Any ideas?

this would be straightforward to code in C; in native components, you could use nested if …then statements inside an ‘evaluate function’ component

Hi, thanks, do you happen to know how could I make this with nested “if” “then” statements natively in gh?

Maybe a little inelegant but…

Hah! Thats a great one Ethan, very elegant. Uses the fact that comparisons evaluate to a 1 if true, or 0 if not true. Very clever. Much simpler than the approach I suggested.

Thanks Mark! Here’s the above translated into an expression.