Expression designer: embedding 'and' in 'if' operation

Hi all,
does anybody know if you can use logical gates within functions in expression designer?
In this example I wanted it to return “1” if both the criteria were met and “0” if not.
Is there a way to do that?

(I know I can use logical gates, I am asking if it can be done in expression designer)

and.gh (4.3 KB)

if((x>y) and (x<z), 1, 0)
2 Likes

grrrr… I was almost there!!! :smile: :smile: :smile:
thank you!

btw, is there an if-else function?

eg:

if x<y … 0
else if y<x<z …1
else if z<x …2

No, you can only nest if function in expressions

This would be the equivalent (apart from the last “huh?”):

if(x<y, 0, if((y<x) and (z<z), 1, if(z<x, 2, "huh?")))

// Rolf

1 Like

I bet you meant:
if(x<y, 0, if((y<x) and (x<z), 1, if(z<x, 2, “huh?”)))

Thanks RIL!
I was drowning in parenthesis(es) / parenthesae/ parentheses … anyway those things!
you clarified it for me!

Ah, yes, that z. Perhaps it was due to Zzzzz… :sleeping:

Edit: The approach I use when writing nasty nested things like this is to first put in all the nested “groups”, like so:

if(,,if(,,if(,,)))

and then fill in the blanks.
// Rolf

1 Like

niiiceeee!
good tip!