This is my first ruby app. And I am a stack overflow virgin... When I run the following program:
class NameApp
def intialize(name)
@names = []
end
def name_question
print "What is your name? "
answer = gets.chomp
@names += answer.to_s
puts "The number of characters in your name is " + names.length
end
def name_length
if @names.length > 25 then
print "Your name is longer than 25 characters."
else
print "Your name is too short."
end
end
end
name_app = NameApp.new("Test1")
name_app.class # => NameApp
name_app.name_question
name_app.name_length
I get this simple error message result:
name.rb:26:in `initialize': wrong number of arguments(1 for 0) (ArgumentError)
from nameapp.rb:26:in `new'
from nameapp.rb:26:in `<main>'
Can you help me trouble shoot?
initialize
being misspelt is more useful. – Servais