3 ms·
Not a Ruby guy, but Scala uses that syntax for all method declarations: // type annotations are optional, if the compiler can infer them def foo = 42
by kagakuninja 3y ago
Not a Ruby guy, but Scala uses that syntax for all method declarations:
// type annotations are optional, if the compiler can infer them
def foo = 42
def bar(x: Int): String = {
// stuff
}
It works fine IMO. Scala 3 introduced Python-style syntax, in which {} is optional:
def bar(x: Int): String =
// stuff
end bar // end is optional