You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an error in the Tour of Scala, Basics, Case Classes example.
case class Point(x: Int, y: Int)
val point = Point(1, 2)
val anotherPoint = Point(1, 2)
val yetAnotherPoint = Point(2, 2)
if (point == anotherPoint) {
println(point + " and " + anotherPoint + " are the same.")
} else {
println(point + " and " + anotherPoint + " are different.")
}
if (point == yetAnotherPoint) {
println(point + " and " + yetAnotherPoint + " are the same.")
} else {
println(point + " and " + yetAnotherPoint + " are different.")
}
Running the code in https://scastie.scala-lang.org/ throws: value + is not a member of Playground.Point, but could be made available as an extension method.
Using a String type as the first argument seems resolves the issue: println(point.toString + " and " + anotherPoint + " are the same.")
or println("" + point + " and " + anotherPoint + " are the same.")
The text was updated successfully, but these errors were encountered:
There seems to be an error in the Tour of Scala, Basics, Case Classes example.
Running the code in https://scastie.scala-lang.org/ throws: value + is not a member of Playground.Point, but could be made available as an extension method.
Using a String type as the first argument seems resolves the issue:
println(point.toString + " and " + anotherPoint + " are the same.")
or
println("" + point + " and " + anotherPoint + " are the same.")
The text was updated successfully, but these errors were encountered: