Array Ranges



Using ranges in array
Smart pascal source code
type TTest = (one, two, three); { unit1.pas } var a : array of integer = [1..5]; b := [one..three, one, three..one]; i: integer; Begin for i in a do WriteLn(i); { CONSOLE OUTPUT 1 2 3 4 5 } a := [5..1]; for i in a do WriteLn(i); WriteLn(''); { CONSOLE OUTPUT 5 4 3 2 1 } a := [1..3, 5, 3..1]; for i in a do WriteLn(i); WriteLn(''); { CONSOLE OUTPUT 1 2 3 5 3 2 1 } for i in b do WriteLn(b[i].Name); { CONSOLE OUTPUT one two three one three two one }