Infix Notation : Kotlin

This post was originally posted at https://agrawalsuneet.github.io/blogs/infix-notation-kotlin/ and reposted on Medium on 7th Oct 2018.
infix fun Int.add(b : Int) : Int = this + bval x = 10.add(20)
val y = 10 add 20 // infix call
  • They must be member functions or extension functions.
  • They must have a single parameter.
  • The parameter must not accept a variable number of arguments and must have no default value.

What if I use an infix function with other operators.

Please continue reading at https://agrawalsuneet.github.io/blogs/infix-notation-kotlin/

It's completely free. No Account signup. No membership required. No Gimmick.

--

--

--

https://agrawalsuneet.github.io/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Overview of Amazon Kinesis & Kinesis Firehose

We fired our top talent. Best decision we ever made.

Data Transfer From country to country

Team Zendodo Update #18

Thinking of Building a Contact-tracing Application? Here’s what you can do instead — Part 2

PARSIQ Q&A #41

Introducing the new Desmos Validator Program

Developing an original API function with doorkeeper and oauth2.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suneet Agrawal

Suneet Agrawal

https://agrawalsuneet.github.io/

More from Medium

Null Safety in Kotlin

Kotlin Collections & Operations

Kotlin Programming Language: Everything You Need to Know

Getting… rid of those missing android* source sets warnings on your KMP project