KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Very handy Ruby code: some_map.each do |key,value| # do something with key or value end Scala equivalent: someMap.foreach( entry => { val (key,value) = entry // do something with key or value }) Having to add the extra val line bugs me. I couldn't figure out how to state the function arg to extract the tuple, so I'm wondering is there a way to do this, or why is there no foreach that extracts the key and value for me?
Tags (comma-separated)
Save Edits
Cancel