stack peek



stack_peek
Smart pascal source code
type TStringDynArray = array of string; var s: TStringDynArray; procedure DoPeek(s: TStringDynArray); begin try WriteLn(s.Peek); except on E: Exception do WriteLn(E.Message); end; end; DoPeek(s); s := ['hello', 'world']; DoPeek(s); s.Swap(0, 1); DoPeek(s); s.Delete(0); DoPeek(s); s.Clear; DoPeek(s); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Upper bound exceeded! Index 0 in DoPeek [line: 7, column: 17] world hello hello Upper bound exceeded! Index 0 in DoPeek [line: 7, column: 17] ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}