Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Foreach loop
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== ParaSail === The [[ParaSail (programming language)|ParaSail]] parallel programming language supports several kinds of iterators, including a general "for each" iterator over a container: <syntaxhighlight lang="parasail"> var Con : Container<Element_Type> := ... // ... for each Elem of Con concurrent loop // loop may also be "forward" or "reverse" or unordered (the default) // ... do something with Elem end loop </syntaxhighlight> ParaSail also supports filters on iterators, and the ability to refer to both the key and the value of a map. Here is a forward iteration over the elements of "My_Map" selecting only elements where the keys are in "My_Set": <syntaxhighlight lang="parasail"> var My_Map : Map<Key_Type => Univ_String, Value_Type => Tree<Integer>> := ... const My_Set : Set<Univ_String> := ["abc", "def", "ghi"]; for each [Str => Tr] of My_Map {Str in My_Set} forward loop // ... do something with Str or Tr end loop </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)