Skip to content

Instantly share code, notes, and snippets.

@25564
Created March 18, 2016 03:20
Show Gist options
  • Save 25564/0a2671f5e05a8b3805a6 to your computer and use it in GitHub Desktop.
Save 25564/0a2671f5e05a8b3805a6 to your computer and use it in GitHub Desktop.
CODE NETWORK!
object Calculator extends App {
def multiply(a:Int, b:Int) = a * b
def minus(a:Int, b:Int) = a - b
def add(a:Int, b:Int) = a + b
def divide(a:Int, b:Int) = a / b
def execute(f: (Int, Int) => Int, a: Int, b: Int):Int = { //Functions are objects in Scala
f(a,b)
}
println(execute(add, 31, 11)) //Meaning of Life
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment