Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Build an Address Book in Ruby Input and Output Displaying a Menu

Muhammad Saif
Muhammad Saif
11,565 Points

Keep getting the error address_book.rb:98: syntax error, unexpected end-of-input, expecting keyword_end

Hi I keep getting error for this code :

def run
    loop do
      puts "Address Book"
      puts "a: Add Contact"
      puts "p: Print Address Book"
      puts "e: Exit"
      print 'Enter your choice: '
      input = gets.chomp
      case input
      when 'e'
        break
      end
    end
  end

address_book = AddressBook.new
address_book.run

Above is the written code. When I run this I get

address_book.rb:98: syntax error, unexpected end-of-input, expecting keyword_end

The 98th line is

address_book.run

What is wrong with my code?

1 Answer

I don't even now ruby but could it be that you forgot and missed one of those "end" keywords near the bottom of your code