Re: foreach routine
- Posted by Derek Parnell <ddparnell at bigpond.com> Dec 22, 2006
- 666 views
duke normandin wrote: > Like I said in another post, I basically trying to emulate Perl's `foreach' > routine, as in: > foreach $pair (@pairs){ > do something > } > > where @pairs is a simple array (no sweat! => a "U4ia" sequence) > $pair is a variable used in "list" context so it gets a string
include foreach.e function do_something(integer x, object item, object extra) -- Do something with the item return 0 end function sequence result result = foreach(pairs, routine_id("do_something")) if result[1] = 0 then -- No problems else -- Something went wrong end if
I know about 'foreach' as I use it all the time in the D programming language. D is a bit like a static-typed, object-enabled, compiled Euphoria. http://www.digitalmars.com/d/statement.html#ForeachStatement I also use it in the Progress 4GL (OpenEdge) which is a proprietary database language. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell