Iif

From Soldat Community Wiki
Jump to: navigation, search

From the Scripting Manual

function iif(condition: boolean; const truePart: variant; const falsePart: variant): variant;

Parameter Info:
 Condition (Boolean): TRUE or FALSE value.
 truePart (Variant): Variable which shall be returned if (Condition) is TRUE
 falsePart (Variant): Variable which shall be returned if (Condition) is FALSE

Description:
 This function acts the same as a normal IF statement, however it may be used inline.

Examples

var
MyCondition: boolean;
MyInt: integer;
begin
    MyInt := 5942;
    WriteLn('The condition is currently '+iif(MyCondition,'true','false')); //The condition is currently false
    MyCondition := true;
    WriteLn('The condition is currently '+iif(MyCondition,'true','false')); //The condition is currently true
    WriteLn('The condition is currently '+iif(MyInt > 6000,'true','false')); //The condition is currently false
    MyInt := 8468;
    WriteLn('The condition is currently '+iif(MyInt > 6000,'true','false')); //The condition is currently true
end;


External Links