anikolo
(Aris )
August 31, 2018, 8:18pm
1
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)
gankeyu
(Keyu Gan)
August 31, 2018, 8:23pm
2
if((x>y) and (x<z), 1, 0)
2 Likes
anikolo
(Aris )
August 31, 2018, 8:25pm
3
anikolo
(Aris )
August 31, 2018, 8:31pm
4
btw, is there an if-else function?
eg:
if x<y … 0
else if y<x<z …1
else if z<x …2
gankeyu
(Keyu Gan)
August 31, 2018, 8:35pm
5
No, you can only nest if
function in expressions
RIL
(Rolf)
August 31, 2018, 8:45pm
6
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
anikolo
(Aris )
August 31, 2018, 8:49pm
7
RIL:
if(x<y, 0, if((y<x) and (z<z), 1, if(z<x, 2, “huh?”)))
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!
RIL
(Rolf)
August 31, 2018, 8:52pm
8
Ah, yes, that z. Perhaps it was due to Zzzzz…
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