I am currently learning Scala using a tutorial, and I have come across a syntax I do not understand (and I haven not found the answer):
object Demo {
def main(args: Array[String]) {
println(apply(layout, 10))
}
def apply(f: Int => String, v: Int) = f(v)
def layout[A](x: A) = "[" + x.toString() + "]"
}
In
def layout[A](x: A) = "[" + x.toString() + "]"
I do not understand the [A] after layout and before the argument declaration.
Is it the return type?
For me the general syntax for a function in scala is the following;
def functionName ([list of parameters]) : [return type] = {
function body
return [expr]
}