Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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