[Pas2js] for .. in loop

Mattias Gaertner nc-gaertnma at netcologne.de
Fri May 18 16:11:05 CEST 2018


On Fri, 18 May 2018 20:24:44 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

> I wanted to do a follow up here on my bug report about the for loop. So I learned it does work but only if the element being iterated is a string. Why is it limited to just strings? The array could have any other object in it right? At least give an error message to makes sense. No one will expect you can only iterate JSArrays with strings by design.

var
  o: TJSObject;
  key: string;
begin
  for key in o do writeln(o[key]);
end;

Mattias


More information about the Pas2js mailing list