Question: I am doing an exercise on exercism.io. This is requested in the Spec document:

1. The `Hello World!` program will greet me, the caller.
2. If I tell the program my name is Alice, it will greet me by saying "Hello, Alice!".
3. If I neglect to give it my name, it will greet me by saying "Hello, World!"

---

```
class HelloWorldTest < Minitest::Test
  def test_no_name
    assert_equal 'Hello, World!', HelloWorld.hello
  end

  def test_sample_name
    assert_equal 'Hello, Alice!', HelloWorld.hello('Alice')
  end

  def test_other_sample_name
    assert_equal 'Hello, Bob!', HelloWorld.hello('Bob')
  end
end

```

This is my program:

```
class HelloWorld
  def self.hello
    "Hello, World!"
  end

  def initialize(name)
    @name = name
  end

  def say_hello
    puts "Hello, #{@name}!"
  end
end

print "Give me your name: "
your_name = gets.chomp
hello = HelloWorld.new(your_name)
if your_name == ""
  puts "Hello, World!"
else
  hello.say_hello
end

```

The program runs and satisfies all of the requirements, but I get the error:

```
1) Error:
HelloWorldTest#test_sample_name:
ArgumentError: wrong number of arguments (given 1, expected 0)
    /Users/drempel/exercism/ruby/hello-world/hello_world.rb:3:in `hello'
    hello_world_test.rb:24:in `test_sample_name'

3 runs, 1 assertions, 0 failures, 1 errors, 1 skips

```

How do I define a method that doesn't require arguments?

Answer: 
> 
> How do I define a method that doesn't require arguments?
> 
> 
> 

Your problem is the opposite. You are passing an argument to a method `HelloWorld.hello`, which does not take an argument.

Your test code does not match what your source code is doing. Either change your source code to:

```
class HelloWorld
  def self.hello(name = "World")
    "Hello, #{name}!"
  end
end

```

Here, the `name = "World"` indicates that the `name` argument is optional, and that the default value is `"World"`.

Or, change your tests to:

```
assert_equal 'Hello, Alice!', HelloWorld.new('Alice').say_hello
assert_equal 'Hello, Bob!', HelloWorld.new('Bob').say_hello

```
> 
> How do I define a method that doesn't require arguments?
> 
> 
> 

It's important to understand what the error message means, as I had a similar problem on Learn.co's [Object-Oriented TicTacToe challenge](https://learn.co/tracks/full-stack-community-bootcamp/intro-to-ruby-development/oo-tic-tac-toe/oo-tic-tac-toe). When your code is ran against the test code, the test code is "giving" one argument of `'Alice'` to the `#self.hello` method. But your `#self.hello` method as written is expecting exactly zero arguments. Hence:

```
ArgumentError: wrong number of arguments (given 1, expected 0)
/Users/drempel/exercism/ruby/hello-world/hello_world.rb:3:in `hello'
hello_world_test.rb:24:in `test_sample_name'

```

My error message was similar and I had the same train of thought: "If it expected 0, how can I give it 0?" Clearly, a key takeaway from our experience is to better understand now what the error message meant.