How to create a 2D point data structure with two floating-point numbers in Scala

1 Answer

0 votes
object MyClass {
    case class Point(x: Float, y: Float)
    
    val p = Point(9.48f, 6.71f)
    
    def main(args: Array[String]): Unit = {
        printf("%f %f", p.x, p.y) 
    }
}
 
 
 
/*
run:
 
9.480000 6.710000
 
*/

 



answered Dec 27, 2022 by avibootz
...