Evaluate three conditions

N

Nicole

started a topic
4 months ago

I am working on a program in lightning lab for Ollie. I need a control statement that will evaluate three different conditions - For example - if the value is greater than 10 set the color to red; if the value is between 6 and 10 set the color to yellow; if the value is less than 6 set the color to green.

If I was only evaluating for two conditions I would just use an If Else statement - if greater than 10 set red else if less than 10 set green - What should I use to evaluate these three conditions?

I would like to just add another 'else' control, but I only see the option of adding an If Else statement - how can I get another 'else' in with my original control statement?

Thank you for your help.

1 Comment

J

Jennifer Howard

said
3 months ago

You will want to nest If Then Else statements...

If x>10 then

Red

Else

If x >5 then

Yellow

Else

Green

it will first compare to see if greater than 10 if not it will then compare to see if >6 but less than 10 (since it already compared to 10 in the first if) , finally if not more than 5 it will go to the final else.