How does one send the result of an anonymous function as an argument into another function?
As an example:
object TestThisFunction {
def getString(): String = {
"foo"
}
def useString(foo: String) = {
println(foo + "bar")
}
useString("foo");
useString(getString());
// This does not work: type mismatch; found : () => String required: String
useString(() => {
"foo"
})
}
Is there some syntax that would make the last call to useString() work using an anonymous function?
Thank you for your time.