I am a newbie in scala. I am trying to understand below lines of code:-
val word = "f"
val file = "resources/abc.dat"
val func: (String) => String = word match {
case "f" => first
case "s" => second
case "t" => third
case _ => default
}
def first(file: String) : String = {
println("First" + file)
"first"
}
def second(file: String) : String = {
println("Second" + file)
"second"
}
def default(file: String) : String = {
println("Default" + file)
"default"
}
What I understand so far is in func, word is matched with cases and particular function is called.But I don't understand how arguments are passed to each function call.
Any pointers will be of great help to me.
Thanks.