IF THEN ELSE expression Example V |
Smart pascal source code
var b: Boolean; var o1 := if b then TObject.Create else nil; var o2 := if b then nil else TObject.Create; WriteLn(if Assigned(o1) then o1.ClassName else 'nil'); WriteLn(if Assigned(o2) then o2.ClassName else 'nil'); {<<< RESULT - CONSOLE LOG >>> ----------------------------- nil TObject ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}