This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lazyFun(aThing: => Unit) = { | |
println("doing a thing") | |
aThing | |
println("done") | |
} | |
// correct | |
lazyFun(println("a thing")) | |
// incorrect - compiles thanks to value discard, but doesn't print | |
lazyFun(() => println("another thing")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Board._ | |
import scala.annotation.tailrec | |
case class Position( | |
row: Int, | |
column: Int | |
) | |
sealed trait Player { |