Hi Given below is the code. The function Split_line
returns an Array. I suppose the value splitted
should be of type Array
. But is considered as Unit
by the Compiler. What am I doing wrong here?
object Main {
def Split_line(line: String){
line.split("\\|\\|")
}
def main(args: Array[String]) {
val splitted = Split_line("This is a line || hi ")
//***I am getting error here : 'value foreach is not a member of Unit'
splitted.foreach(println)
}
}