Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:08:33+00:00 2026-06-14T16:08:33+00:00

The following code is showing me the error as follows: ruby -KU — ‘C:\Users\Ishmael\My

  • 0

The following code is showing me the error as follows:

"ruby -KU -- 'C:\Users\Ishmael\My Documents\Aptana Studio 3 Workspace\Simple\FirstFile'
C:/Users/Ishmael/My Documents/Aptana Studio 3 Workspace/Simple/FirstFile:55: syntax error, unexpected $end, expecting keyword_end"

I searched for the extra end(s) and the trailing ‘.’s but in vain and I still can’t figure out why it’s not working!

class Greeter
  attr_accessor :name

  def initialize(name="dudes")
    @name=name
  end

  def say_hi

    if @name.nil?
      puts "..."
    else if @name.respond_to?("each")

      @name.each do |name|
        puts "Hello #{name.capitalize}!"
      end

    else
      puts "Hi #{@name.capitalize}!"
    end

  end 

  def say_bye

    if @name.nil?
      puts "..."
    else if @name.respond_to?("join")
      puts 'Goodbye #{@name.join(", ").capitalize}! Come back soon!'
    else
      puts "Bye #{@name.capitalize}!"
    end

  end

end

if __FILE__ == $0

  greeter = Greeter.new
  greeter.say_hi
  greeter.say_bye

  greeter.name = "Ishmael"
  greeter.say_hi
  greeter.say_bye

  greeter.name = ["Albert", "Brenda", "Charles", "Dave", "Englebert"]
  greeter.say_hi
  greeter.say_bye

  greeter.name = nil
  greeter.say_hi
  greeter.say_bye
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:08:35+00:00Added an answer on June 14, 2026 at 4:08 pm

    It’s not complaining about an extra end, but a premature end of the file, because of a missing end. In this case, You’re forgetting to close the class before your if __FILE__ == $0 part.

    This is probably because you confused elsif with else if, the latter one creating a whole new if block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I am running this code it showing me a following error:- Column 'virtuemart_product_id'
In laravel for showing all error messages at once i use the following code
I got the following generated code from sudzC and the generated code showing error.
I am having problem with following code. Its showing compliation error:- Identifier Expected. <script
I am using the following code, but it showing a 404 error $url =
The following code (without showing it all) is my first attempt at using classes.
I am using following code for showing a MessageBox with ok and cancel button.
I currently have the following code which delays showing a fixed bar after a
i wrote following code to create a linkbutton programmatically, but its showing like lable
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.