In Scala, it is possible to call a function without using parentheses. For example, "1,2,3" split ","
is a valid statement, which behaves the exact same way as "1,2,3".split(",")
.
How can I define a function that can be called this way? My experience with this (creating a class with a member function, and then try to call it without .
and ( )
) didn't work out, it just raised a syntax error.