Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Type
TForm1 = class(TForm)
Label1: TLabel;
Function IIF(Expression:boolean;ifTrue,ifFalse:string):string;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
End;
Var
Form1: TForm1;
implementation
{$R *.dfm}
Function Tform1.IIF(Expression:boolean;ifTrue,ifFalse:string):string;
Begin
If Expression Then
IIF := ifTrue
Else
IIF := ifFalse;
End;
Procedure TForm1.FormCreate(Sender: TObject);
Var j:integer;
Begin
//exempel på hur du kan använda IFF:
j := 5;
Label1.Caption := form1.IIF(j = 5,'Talet är 5','Talet är inte 5');
End;
End.