In Delphi, I can define a range of characters or integers as demonstrated below:
var
a,i: integer;
b: char;
intrange: 1..9;
charrange: 'α' .. 'ζ';
begin
for a := low(IntRange) to high(IntRange) do
begin
Memo1.Lines.Add('Integer Range Iteration = ' + intToStr(a) ) ;
end;
i:=0;
for b := low(charrange) to high(charrange) do
begin
i := i + 1;
Memo1.Lines.Add('Character Range Iteration = ' + intToStr(i) + ', value = ' + b +' ord '+ inttostr(ord(b))) ;
end;
end;
How can I pass a range as a parameter to a function?
You can use subrange types:
Now you can do
whereas
won’t work.