Question: Write a Hello World! function that can greet someone given their name. The function should return the appropriate greeting. For an input of Alice, the

Write a Hello World! function that can greet someone given their name. The function should return the appropriate greeting.
For an input of "Alice", the response should be "Hello, Alice!".
If a name is not given, the response should be "Hello, World!"
This function will be a class level method on a HelloWorld class. It will be called like this from the tests:
HelloWorld.hello
HelloWorld.hello('Alice')
Test-Driven Development
As programmers mature, they eventually want to test their code.
At Exercism we simulate Test-Driven Development (TDD), where you write your tests before writing any functionality. The simulation comes in the form of a pre-written test suite, which will signal that you have solved the problem.
It will also provide you with a safety net to explore other solutions without breaking the functionality.
A typical TDD workflow on Exercism:
Run the test file and pick one test that's failing.
Write some code to fix the test you picked.
Re-run the tests to confirm the test is now passing.
Remove "skip" from one of the other included tests.
Repeat from step 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!