Skip to content

Instantly share code, notes, and snippets.

@RickGriff
Created December 11, 2017 21:57
Show Gist options
  • Save RickGriff/714abbbd4fd86e3477d2b69acd5cae98 to your computer and use it in GitHub Desktop.
Save RickGriff/714abbbd4fd86e3477d2b69acd5cae98 to your computer and use it in GitHub Desktop.
Codewars Challenge 1 - Jenny's Secret Message
#Jenny has written a function that returns a greeting for a user. However, she's in love with Johnny, and would
#like to greet him slightly different. She added a special case to her function, but she made a mistake.
#Can you help her?
#Initial Code with Error:
def greet(name)
return "Hello, #{name}!"
return "Hello, my love!" if name == "Johnny"
end
#My Solution:
def greet(name)
return "Hello, my love!" if name == "Johnny"
"Hello, #{name}!"
end
@DumontHenry
Copy link

it doesn't work as there is no function end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment