fork download
  1. object Main extends App {
  2.  
  3. val age = 27
  4.  
  5. def addOne(x:Int) : Int = {
  6. x+1
  7. }
  8.  
  9. var increase = addOne _
  10.  
  11. println(increase(age)) // output 28
  12.  
  13. increase = (x: Int) => x + 99
  14.  
  15. println(increase(age)) //output 126
  16.  
  17. }
Success #stdin #stdout 0.4s 322176KB
stdin
Standard input is empty
stdout
28
126