From: sto.mar@... Date: 2013-07-25T19:39:36+09:00 Subject: Re: Ruby newbie question on Methods (NoMethoderror) Am 25.07.2013 12:22, schrieb Crispian A.: > C:/Users/Gemini/Documents/Aptana Studio 3 > Workspace/rubyProject/rubyTest.rb:51:in `
': undefined method > `games' for main:Object (NoMethodError) this should be a rather good hint... > > My Code here where the problem exists: > > puts "Would you like to play a game?(Y/N)" > userAnswer = gets.chomp > puts "You said #{userAnswer}" > > if userAnswer == "Y" > puts "Please choose from the list below:" > > games = ["Pacman", "Mario Brothers", "Bomberman"] > puts "#{games}" > > puts "Select between 0 and 2 to select your game of choice" > selectGame = games(gets.chomp) this is probably line 51... you probably mean: selectGame = games[gets.chomp.to_i] > puts " You chose #{selectGame(gets.chomp)}" that doesn't make sense, rather: #{selectGame} > > elsif userAnswer == "N" > puts "Do you not like games?(Y/N)" > userAnswer = gets.chomp > > else puts "You did not choose an option!" > > end Also, in the Ruby community snake_case is used for variable names. Regards, Marcus --