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