mixed nil array



mixed nil array
Smart pascal source code
type TTest = class end; procedure WriteLnArray(a: array of TObject); begin if a.Length = 0 then WriteLn('Empty') else begin var i: Integer; for i := 0 to a.High do begin WriteLn(i); WriteLn(' : '); if a[i] = nil then WriteLn('nil') else WriteLn(a[i].ClassName); end; end; end; var a: array of TObject; var o := TObject.Create; var t := TTest.Create; WriteLnArray(a); a := [nil]; WriteLnArray(a); a := [o, t]; WriteLnArray(a); a := [t, o]; WriteLnArray(a); a := [o, nil]; WriteLnArray(a); a := [nil, o]; WriteLnArray(a); a := []; WriteLnArray(a); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Empty 0 : nil 0 : TObject 1 : TTest 0 : TTest 1 : TObject 0 : TObject 1 : nil 0 : nil 1 : TObject Empty ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}