RosettaCodeData/Task/Associative-array-Creation/Scala/associative-array-creation-3.scala

5 lines
187 B
Scala
Raw Permalink Normal View History

2013-04-10 14:58:50 -07:00
// iterate over key/value
hash.foreach {e => println("key "+e._1+" value "+e._2)} // e is a 2 element Tuple
// same with for syntax
for((k,v) <- hash) println("key " + k + " value " + v)