Limitations
The infix
function needs to take exactly one parameter. This means:
- No zero-parameter functions
- No functions with 2+ parameters
- No varargs
- No default values
Also, it cannot be a top-level function — the function needs to have a receiver of some form. In the preceding example, we have it as an extension function, though a regular class function is also fine.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.