Re: case and foreach
- Posted by cklester <cklester at yahoo.com> Mar 31, 2005
- 567 views
codepilot Gmail Account wrote: > > Pros > I think foreach could be used to add some parallelism to euphoria and > simplify a few things that for loops and subscripting are used for. > Case would be good for simplifying if/elsif/else blocks to a more > manageable level and could also help in optimization. > > Cons > Does anyone have something against case or foreach(element in a > sequence) in euphoria? I use the for...each construct a lot in my VBA programs. However, that's because I can iterate through objects. For example: dim tbl as Table for each tbl in ActiveDocument.Tables '... manipulate the data next Since Euphoria doesn't have objects, I don't see how this would be more useful than what's already available. for each x in 1 to 50 do ?x end for Although it would work for iterating through sequences... sequence s s = {1,2,3,4,5} for each x in s do ?x end for Do any of the OOP libraries out there use this construct to loop through objects in a class/library/whatever? -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/