Advertisement
Guest User

1

a guest
Jul 22nd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.45 KB | None | 0 0
  1. /**
  2.   * Created by levkovich.n on 22/07/2016.
  3.   */
  4. object Main extends App {
  5.   printTable((a: Boolean, b: Boolean, c: Boolean) => and(a, and(b, c)))
  6.  
  7.   def printTable(f: (Boolean, Boolean, Boolean) => Boolean): Unit = {
  8.     val bool = List[Boolean](false, true)
  9.     println(s"A\t\tB\t\tC\t\tresult")
  10.     for (a <- bool; b <- bool; c <- bool)
  11.       println(s"$a\t$b\t$c\t${f(a, b, c)}")
  12.   }
  13.  
  14.   def and(a: Boolean, b: Boolean): Boolean = a && b
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement