I’m reading the docs and I came across something called infix function. Is this something like a type setted function? In Java a function is always given a type whether it’d be a data type or just void. Is it similar to the concept that I mentioned?
l
Landry Norris
10/26/2022, 9:51 PM
An infix function is just a function where instead of writing
a.or(b)
, you can write
a or b
. It’s just syntactic sugar.
➕ 1
Landry Norris
10/26/2022, 9:52 PM
Infix functions still return a type. They just change how the method is written when it is called.
j
Joseph S
10/26/2022, 10:10 PM
Ah I see alright
s
Stephan Schroeder
10/27/2022, 8:43 PM
It's useful to write a DSL. (so are lambdas with receivers)