Available in:
Apps (win)
Apps (char)
Reportwriter
RPC
Standalone PL
X
X
X
X
X
expr decode(code,val1,ret1[,val2,ret2,...],default) expr code, valn, retn, default
Compares code to each val[n]. When it finds a match, it returns ret[n]. If it doesn't find a match, it returns default.
Note: All of the expressions, that is val[n] and ret[n], are evaluated before code is compared against the val[n] expression(s).
{ int confirm; char response[80]; response = prompt("Enter YES or NO ==> ") confirm = decode(response,"N",0,"NO",0,"Y",1,"YES",1,-1); }Executes different code based on variable:
execute(decode(case,1,trigger_code1,2,trigger_code2,default_code));