Hi I'm trying to get this expression to work but i keep getting a syntax error what could I do to fix it?
if(ch(“../Controls/Width”)%2 ==0, 0,) if(ch(“../Controls/Width”)%2 !=0, 1)
Im essentially trying to make it so that is my control is on an even number it does the first one but if it is on an odd number it does the other
Question about switch node
1634 1 1- vishnu1024
- Member
- 68 posts
- Joined: March 2016
- Offline
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
Vishnu Gollakota
if(ch(“../Controls/Width”)%2 ==0, 0,) if(ch(“../Controls/Width”)%2 !=0, 1)
This should work:
if(ch(“../Controls/Width”)%2 ==0, 0, 1)
However, this is a bit overkill, because “ch(”../Controls/Width“)%2” is already zero when ch(“../Controls/Width”) is an even integer and one when it is an odd, positive integer, so if you know that it'll be positive you can just do:
ch(“../Controls/Width”)%2
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
-
- Quick Links