- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:33 AM
Hi All,
Hopefully an easy question; i need to script an if condition to say active = true and state is not 6, 7 or 8. What's the best way to write this, can i comma-separate options or do i need to write out each state individually? I tried option 1 below and it didn't work so not really sure where to go from here.
if(active = true && state != 6 && state != 7 && state != 8){
//stuff here
}
if(active = true && state != 6, 7, 8){
//stuff here
}
if(active = true && state != 6 || 7 || 8){
//stuff here
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:37 AM
Hi David,
Try add one more bracket before state and it will work.
if(active = true && (state != 6 && state != 7 && state != 8)){
//stuff here
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:37 AM
Hi David,
Try add one more bracket before state and it will work.
if(active = true && (state != 6 && state != 7 && state != 8)){
//stuff here
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:44 AM
Hi David,
in your question , you mentioned as OR condition and in code you are trying with and(&&),
the best way you can do is && or ! condition, like Akash and Vinoth replies are helpful.
Regards
Bitra