Skip to content

Instantly share code, notes, and snippets.

@bandrzejczak
Created February 9, 2018 21:49
Show Gist options
  • Save bandrzejczak/4986959be58735137b921c70b424bf3f to your computer and use it in GitHub Desktop.
Save bandrzejczak/4986959be58735137b921c70b424bf3f to your computer and use it in GitHub Desktop.
object ScalarPuzzle extends App {
implicit class TernaryOps(cond: => Boolean) {
def ??(thenBlock: => Unit) = new {
def ::(elseBlock: => Unit): Unit =
if(cond) thenBlock else elseBlock
}
}
(1 + 1 == 2) ?? println("True") :: println("False")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment