My code:
class Point(xA: Int)
{
val x = xA
}
fun AddVectorToPoint(i: Int): Point()
{
val x: Int = 1 + i
val obj = Point(x)
return obj
}
fun main()
{
val points = mutableListOf(Point(0))
points.add(AddVectorToPoint(2))
}
But when I try to compile this, I get "test.kt:6:36: error: expecting a top level declaration > fun AddVectorToPoint(i: Int): Point() {" What am I doing wrong?
fun AddVectorToPoint(i: Int): Point()line. It must like this.