type
TTiger = class
end;
//runtime type checks with "is"
function Describe(Obj: TObject): string;
begin
if Obj = nil then
Exit('Empty value');
if Obj is TTiger then
Exit('Tiger!!!');
Result := 'Unknown type';
end;
var
Expression: string;
begin
WriteLn(Describe(TTiger.Create));
//printed 'Tiger!!!'
WriteLn(Describe(nil));
//printed 'Empty value'
//case works only with ordinals:
//strings are matched with if/else
Expression := '3*3';
if Expression = '3 + 3' then
WriteLn('result = 6')
else if Expression = '3*3' then
WriteLn('result = 9')
else
WriteLn('unknown');
end.