Difference between revisions of "ScriptCore3.iif"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m (Example)
 
Line 23: Line 23:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
[[Category:ScriptCore 3]][[Category:Functions]]
+
[[Category:Functions]]

Latest revision as of 16:28, 12 August 2013

function iif(Condition: Boolean; IfTrue, IfFalse: Variant): Variant
 Condition: TRUE or FALSE value.
 IfTrue: Variable which shall be returned if (Condition) is TRUE
 IfFalse: 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.

Example

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;