From: "Sebastjan H." Date: 2012-08-03T22:44:38+09:00 Subject: Re: learning by doing part 2 - tc game In this line you wrote > target.hp -= 200 # supposing target has methods #hp and #hp= what is the meaning of the equal sign? #hp= Because in my case above the target only has hp method. And if I remodel it to your example: def attack(target) target.hp -= 200 end class A def initialize(name, hp) @name = name @hp = hp end def hp() @hp end def name() @name end end players = [] << A.new("test", 400) attack(players[0]) puts players[0].hp ------------------------------------- 3.rb:3:in `attack': undefined method `hp=' for # (NoMethodError) from 3.rb:24:in `
' -- Posted via http://www.ruby-forum.com/.