How to write multiple conditions and set values in Fix Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2022 02:15 AM
I need to write a fix script where I need to set values based on multiple conditions.
if(actual value = 0, then new value = neutrals)
if(actual value = 1, then new value = passive)
if(actual value = 2, then new value = neutrals)
if(actual value = 3, then new value = passive)
Can you please help me on this. Thanks in advance.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2022 02:16 AM
Hi, I would recommend that you use a JavaScript switch statement.
https://www.w3schools.com/js/js_switch.asp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2022 02:18 AM
Better to go with switch to write multiple conditions.
Or try with multiple if-else blocks.
if(){
}
else if(condition1){
// add code
} else if(condition2){
// add code
}else{
// add code
}
Thanks,
Sagar Pagar