O'Reilly logo
  • Jiangtao Fu thinks this is interesting:

if a method takes only one parameter, you can call it without a dot or parentheses. The to in this example is actually a method that takes one Int argument. The code 0 to 2 is transformed into the method call (0).to(2).[1] Note that this syntax only works if you explicitly specify the receiver of the method call. You cannot write "println 10", but you can write "Console println 10".


Cover of Programming in Scala, Third Edition


Method takes only one parameter