## Solution

The solution depends on the version of LabVIEW you are using. All versions of LabVIEW support the solution outlined in the *Older Formula Node Syntax* section. LabVIEW 6.x and greater adds the use of C syntax. Both solutions are outlined below. For additional help, please refer to the *VI, Function, & How-To Help* by pressing **ctrl+shift+?**.

#### C Syntax (LabVIEW 6.x and After)

if (x>0 && x<=10)
y=1;
else if (x > 10 && x<= 20)
y = 2;
else if (x > 20 && x<= 30)
y = 3;
else if (x > 30 && x<= 40)
y = 4;
else
y = 0;

###

#### Older Formula Node Syntax (All versions of LabVIEW)

Use the following syntax to implement a multi-conditional statement:

<variable> = <condition> ? (true case):(falsecase);

For this example:

y = ((x > 0) && (x <= 10)) ? 1:((x > 10) && (x <= 20)) ? 2:((x > 20)
&& (x <= 30)) ? 3:((x > 30) && (x <= 40)) ? 4:0;