From: Flaab Mrlinux Date: 2006-11-17T22:56:35+09:00 Subject: [Helppp xD] Newbie issue Hi all!! I've declared a method inside the string class that has to answer the amount of "X" and "2" chars in a string. The string is ALWAYS gonna be 15 chars size. The code is the following: class String # DAME VARIANTES def variantes @variantes = 0 15.times do |@cont| if (self[@cont] == "2" || self[@cont] == "X") @variantes = @variantes + 1 end end return @variantes end end cadena = "XX222XX222XX1X2" puts cadena.variantes And the last line ALWAYS ANSWERS a CERO. Why? Why it doesn't enter the if statement inside the method? Thx -- Posted via http://www.ruby-forum.com/.