SEL Function

SEL(cond, a, b)

Evaluates the boolean condition cond. If cond is true, the function returns a. If cond is false, the function returns b. Also known as an in-line IF statement.

Parameters

cond(BOOL)

The condition to be evaluated.

a(REAL or DINT)

The value to return if cond is true.

b(REAL or DINT)

The value to return if cond is false.

 

The a and b input parameters must be of the same data type.

Return Value

Returns the same data type as the a and b input parameters.

Examples

SEL(_Axis[0].ActPos > 10,  100, SQRT(2)) returns 100 if the Axis 0 Actual Position is greater than 10, otherwise it returns the square root of 2.

 

See Also

Standard Functions


Send comments on this topic.

Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion