IF THEN ELSE expression case II



IF THEN ELSE expression Example II
Smart pascal source code
type TBase = class end; type TChild = class(TBase) end; var cond: Boolean; var base := new TBase; var child := new TChild; WriteLn((if cond then TBase else TChild).ClassName); WriteLn((if cond then base else child).ClassName); WriteLn(if cond then 1.5 else 2); WriteLn((if cond then TChild else TBase).ClassName); WriteLn((if cond then child else base).ClassName); WriteLn(if cond then 2 else 1.5); cond := not cond; WriteLn((if cond then TBase else TChild).ClassName); WriteLn((if cond then base else child).ClassName); WriteLn(if cond then 1.5 else 2); WriteLn((if cond then TChild else TBase).ClassName); WriteLn((if cond then child else base).ClassName); WriteLn(if cond then 2 else 1.5); {<<< RESULT - CONSOLE LOG >>> ----------------------------- TChild TChild 2 TBase TBase 1.5 TBase TBase 1.5 TChild TChild 2 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}