Answer the question
In order to leave comments, you need to log in
Why doesn't the .empty method work in Ruby?
Hello, I tried to write a simple ruby program. But for some reason the empty method doesn't want to work. Here is the code:
class HaveMoney
attr_accessor :haveMoney
def initialize
@haveMoney = haveMoney
end
def checkMoney
if @haveMoney.empty?
puts "Вы ничего не ввели"
elsif @haveMoney <= 99
puts "Плохо"
elsif @haveMoney >= 100
puts "Круто"
end
end
end
mg = HaveMoney.new
puts "Введите сумму: "
mg.haveMoney = gets.chomp.to_i
mg.checkMoney
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question