Elements. Build native projects for any modern development platform, using the language(s) of your choice. Oxygene (Object Pascal), C#, Swift, Java, Go. | RemObjects Software

AllLanguageFeatures

Language: Oxygene, Platform: Echoes, Category: Language
https://github.com/remobjects/ElementsSamples/tree/master/Oxygene/Echoes/Language/AllLanguageFeatures

Iterators.pas

namespace AllLanguageFeatures;

interface

uses
  System.Collections,
  System.Collections.Generic;

type
  Iterators = public class
  private
  protected
  public
    method Foo: IEnumerator; iterator;
    method Bar: IEnumerator<Int32>; iterator;
  end;
  
implementation

method Iterators.Foo: IEnumerator; 
begin
end;

method Iterators.Bar: IEnumerator<Int32>; 
var
  i := 1;
begin
  loop begin
    yield(i);
    inc(i);  
    if i < 0 then break;
  end;
end;

end.