%Case function


Old name
%CaseI
Function
The function implements a programmable switch. Result is an integer value.
Declaration
INT %Case(
   INT in Ctrl, 
   INT in Default, 
   INT in Case1, 
   INT in Value1, 
       ... 
   INT in CaseN, 
   INT in ValueN
 )

Parameters
Ctrl Switch control argument - determines which value will be the function result.
Default Default value. This value will be the function result if none of the switch elements matches the control argument.
ValueX Switch elements. If values of the parameters Ctrl and CaseX are identical, the value of the parameter ValueX will be the function result.

Description
The function gets the value of the parameter ValueX if Ctrl is equal to CaseX. If Ctrl is equal to none of the parameters CaseX, the function gets the value defined in the parameter Default.
Example
%Case(U.Ctrl_PS_GK_Manual,-1, 21,C.Tube02_PS2f_Pol, 22,C.Tube02_PS2a_Pol, 23,C.Tube02_PS2c_Pol)

Napíšte komentár