Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Last active March 15, 2019 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renaudcerrato/904bd296cb15af0e0e97c0dec4da56f3 to your computer and use it in GitHub Desktop.
Save renaudcerrato/904bd296cb15af0e0e97c0dec4da56f3 to your computer and use it in GitHub Desktop.
Kotlin Infix Functions (Standard Library)
// until and step are infix functions
for(i in 0 until 100 step 2) println("$i")
// equivalent to:
for(i in 0.until(100).step(2)) println("$i")
// downTo is an infix function
for(i in 100 downTo 0) println("$i")
// shl, and, xor are infix functions
val i = (0x65acf9 shl 6) and 0x55 xor 0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment