Created
February 9, 2018 21:49
-
-
Save bandrzejczak/4986959be58735137b921c70b424bf3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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