Values & References3 / 16
Up next

Case class equality

case class Point(x: Int, y: Int)

@main def main(): Unit =
  // two case instances are == when their fields match
  println(Point(1, 2) == Point(1, 2))
  // but they are distinct objects
  println(Point(1, 2) eq Point(1, 2))
What you're solving

structural, not by identity