# Right associativity in Scala

We define two methods here, ++ and ++:

Nothing special, right? Yes, for now, until we try removing the parentheses in it.

So the difference is, foo can only be placed on the left side when using ++, and it can only be placed on right side when using ++:. The latter is called right associativity, and methods ending with : are used in the right associativity.

Share