[fpc-pascal] for..in loops?

Alan Mead cubrewer at yahoo.com
Fri Nov 18 22:18:40 CET 2005


I use Perl a lot so the new for..in loops in Delphi caught my eye:

program ForIn;
type TStringArray = array of String;
procedure Demo1(const List: TStringArray);
var S: String;
begin
  for S in List do writeln(S);
end;
var sa: TStringArray;
begin
  Demo1(sa);
end.

fpc 2.0.0 doesn't compile this... are "for..in" loops in a newer
version or will they be sometime soon?  Here is a little blurb about
it from Google's cache:

http://66.102.7.104/search?q=cache:jti97cSprR0J:homepages.borland.com/dthorpe/blog/delphi/2004_08_01_archive.php%3Fshow_id%3D109211211041479238+freepascal+%22for+in%22+loop&hl=en

I'm still using Delphi 7... so it's not clear if this is already
available or in the new Delphi 2006 available next year...

-Alan



More information about the fpc-pascal mailing list