I am doing programming in scala for looping through map.
Below is my code which works fine.
val names = Map("fname" -> "Robert", "lname" -> "Goren")
for((k,v) <- names ) println(s"Key: $k, Value : $v")
When looping through the map, if I give (K,V) instead of (k,v), the program is not compiling. It gives cannot resolve symbol error.
Below is my for loop -
for((K,V) <- names ) println(s"Key: $K, Value : $V")
I am executing this program in IntelliJ IDEA 15 scala worksheet.
Can anyone please explain the reason for this error.