Skip to main content
added 80 characters in body
Source Link
Seggan
  • 3.4k
  • 12
  • 47

Kotlin has the ability to create infix functions:

infix fun Int.foo(x: Int) = this + x * x 2 foo 3 // 11 

Nothing super special like Scala. Just add an infix modifier and you're done. However, all infix functions are at the same precedence and it cannot be modified.

Kotlin has the ability to create infix functions:

infix fun Int.foo(x: Int) = this + x * x 2 foo 3 // 11 

However, all infix functions are at the same precedence and it cannot be modified.

Kotlin has the ability to create infix functions:

infix fun Int.foo(x: Int) = this + x * x 2 foo 3 // 11 

Nothing super special like Scala. Just add an infix modifier and you're done. However, all infix functions are at the same precedence and it cannot be modified.

Source Link
Seggan
  • 3.4k
  • 12
  • 47

Kotlin has the ability to create infix functions:

infix fun Int.foo(x: Int) = this + x * x 2 foo 3 // 11 

However, all infix functions are at the same precedence and it cannot be modified.