forum-msg-id-136577-edit

Original date:2021-12-13 13:22:20 Edited by: _tom Subject: Re: [Phix] Language Feature Request: For Each

  • ''for'' is a keyword; do not overload

python

  • for reference, a Python loop looks like:
for x in mylist: 
   print(x) 

this is a clever way to hide the mess created by off-by-one indexing

suggested new feature

  • the OE/Phix equivalent could look like
each <item> in <sequence> do 
   <... statements> 
end each 

sample usage

  • simulate the existing ''for'' loop
each {i} in  {"one","two","three"} do 
   ? i 
end each 

1 
2 
3 

  • simulate Python loop
each {i,x} in  {"one","two","three"} do 
   ? x 
end each 

"one" 
"two" 
"three" 

  • demonstrate Euphoria thinking

each {i,key,value} in do

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu