fork download
  1. object Main extends App {
  2. println("test1")
  3. println(test1())
  4. println("test2")
  5. println(test2())
  6.  
  7. def test1() : Int = {
  8. f(g())
  9. }
  10.  
  11. def test2() : Int = {
  12. lazy val x = g()
  13. f(x)
  14. }
  15.  
  16. def g() : Int = {
  17. println("Hello")
  18. 42
  19. }
  20.  
  21. def f(x: => Int) : Int = {
  22. x * x
  23. }
  24. }
  25.  
Success #stdin #stdout 0.52s 54640KB
stdin
Standard input is empty
stdout
test1
Hello
Hello
1764
test2
Hello
1764