Skip to content

Instantly share code, notes, and snippets.

View piton4k's full-sized avatar

Martin Pitoňák piton4k

View GitHub Profile
import Board._
import scala.annotation.tailrec
case class Position(
row: Int,
column: Int
)
sealed trait Player {
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"))