By Alvin Alexander. Last updated: January 5, 2015
Scala tip: "Hello"(4)
yields o
. This expression is syntactic sugar, and is evaluated as "Hello".apply(4)
. (When the Scala compiler sees "Hello"(4)
it converts it to "Hello".apply(4)
.) In the same way, BigInt(“1”)
is short for BigInt.apply(“1”)
.