Vote count:
0
I have this code:
val br = new ListBuffer[Piece]
for(i <- 10 to 550 by 65) {
br += new Brick(Point(x = i, y = 20, w = widthB, h = heighB))
}
And a method draw(g, color)
for Piece
class. Now I would like to know how I can call that draw
method for each Piece
in the ListBuffer
. I am trying in this way but I don't get why it's not functional:
br.foreach(x => draw(g, orange))
Thanks for any suggestions what I am doing wrong?
asked 47 secs ago
scala - calling methods of objects using for, ofreach loops
Aucun commentaire:
Enregistrer un commentaire