I am very new to scala and am trying to print the char at each index in a string as follows —
val p = "each other we love"
p.foreach((x, i) => println(s"CHAR@$i $x"))
I assumed that the second argument would be the index of the character which obviously isn't true and thus getting a type error.