Skip to content

Instantly share code, notes, and snippets.

@YusukeKokubo
Created September 19, 2012 03:19
Show Gist options
  • Save YusukeKokubo/3747461 to your computer and use it in GitHub Desktop.
Save YusukeKokubo/3747461 to your computer and use it in GitHub Desktop.
Operator ||| like as ||
class CondOp(val a: Boolean) {
def |||(b: => Boolean) = if (a) a else b
}
object Main {
def main(args: Array[String]) {
implicit def boolWrapper(cond: Boolean) = new CondOp(cond)
true ||| { println("hoge"); false }
false ||| { println("foo"); true}
}
}
@YusukeKokubo
Copy link
Author

lean to scala in "by-name-parameters".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment