Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

learn-co-students/say-hello-ruby-wework-bc-000

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Objectives

  1. Build a method that can be called with an optional argument by defining that method with a default argument.

Instructions

You will build a method calledsay_hello. This method should accept the argument of a person's name. It then should print"Hello " with the name followed by an exclamation point (don't forget that space after the "Hello"). For instance:

# I call on the method, say_hello, and give it the string "Gabriela"say_hello("Gabriela")# The method prints this text to the screen:HelloGabriela!

There is one more thing this method should do: if you call on this method and forget to give it the name of a person, it should just say,"Hello Ruby Programmer!". Use a default argument to accomplish this!

Steps

  1. Runlearn to see where you stand.
  • You probably got two NoMethodErrors. This means the test was looking for a method calledsay_hello but couldn't find it.
  1. Define the method insay_hello.rb
  • Runlearn again. Are you getting a different error? If you haven't seen this error, guess what it's trying to tell you then Google it with the word "ruby".
  1. Get all the tests to pass!
  2. Once all of the tests are passing, uselearn submit to submit your lab.

ViewSay Hello on Learn.co and start learning to code for free.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors11

Languages


[8]ページ先頭

©2009-2025 Movatter.jp