On Tue, 3 Dec 2019, Artur Tarassow wrote:

<hansl>

strings S = defarray("A", "B", "C")
loop foreach i S -q
    eval S[i]
endloop

matrix M = seq(1,3)
loop foreach i M -q
    eval M[i]
endloop

</hansl>

In your examples the counter is a simple index and there would be no substantial differences from "loop i = 1 .. nelem(S)"; IMO a proper extension of the foreach loop to arrays would look more or less like

<hansl>
strings S = defarray("A", "B", "C")
loop foreach i S -q
    eval strlen($i)
endloop
</hansl>

Apart from being rather cool, can you elaborate on the potential advantages?

-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucche...@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it
To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/

Reply via email to