Skip to content

There is an issue regarding variable namings in the tutorials and pedagogy #3559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions en/documentation/quickstart/2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ What if we want to say hello to one person, and not the whole world?
Just redefine `hi` to take a name as a parameter.

{% highlight irb %}
irb(main):015:0> def hi(name)
irb(main):016:1> puts "Hello #{name}!"
irb(main):015:0> def hi(text)
irb(main):016:1> puts "Hello #{text}!"
irb(main):017:1> end
=> :hi
irb(main):018:0> hi("Matz")
Expand All @@ -70,15 +70,15 @@ So it works… but let’s take a second to see what’s going on here.

## Holding Spots in a String

What’s the `#{name}` bit? That’s Ruby’s way of inserting something into
What’s the `#{input}` bit? That’s Ruby’s way of inserting something into
a string. The bit between the braces is turned into a string (if it
isn’t one already) and then substituted into the outer string at that
point. You can also use this to make sure that someone’s name is
properly capitalized:

{% highlight irb %}
irb(main):019:0> def hi(name = "World")
irb(main):020:1> puts "Hello #{name.capitalize}!"
irb(main):019:0> def hi(input = "World")
irb(main):020:1> puts "Hello #{input.capitalize}!"
irb(main):021:1> end
=> :hi
irb(main):022:0> hi "chris"
Expand All @@ -103,9 +103,9 @@ an object for that. Let’s create a “Greeter” class.

{% highlight irb %}
irb(main):024:0> class Greeter
irb(main):025:1> def initialize(name = "World")
irb(main):026:2> @name = name
irb(main):027:2> end
irb(main):025:1> def initialize(input = "World")
irb(main):026:2> @name = input
irb(main):027:2> en
irb(main):028:1> def say_hi
irb(main):029:2> puts "Hi #{@name}!"
irb(main):030:2> end
Expand Down