nresni (8) [Avatar] Offline

Are you sure that the default declared fields in scala class constructor are var because when I re-assign penDown into putPenDown, I have the following compilation error:

Error: (10, 36) reassignment to val
def putPenDown(): Unit = penDown = true

So I declared fields to var explicitly instead of nothing, such as you see below:

class Turtle(var xPosition: Int, var yPosition: Int, var heading: Int, var penDown: Boolean)