Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:32:04+00:00 2026-06-05T11:32:04+00:00

Inches/yard: #{12*3} #{Tora! *3} The second example is confusing, unless you remember that everything

  • 0
"Inches/yard: #{12*3}"
"#{"Tora! "*3}"

The second example is confusing, unless you remember that everything is an object in
Ruby (yes, even string literals! They are of class String.). Since the string literal
creates a String object, you can act on it just like any other object. In this case,
multiplying a string by 3 simply does what you would think: makes three copies of the
string.

I read the above para in one of the ruby book. The first line says The second example is confusing, unless you remember that everything is an object in Ruby. What is there in the second example that i should remember ,everything is an object in ruby ? Isn’t it just a feature that multiplying by 3 will print tora three times ?

I don’t exactly understand what does the author want me to understand from the above paragraph

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:32:07+00:00Added an answer on June 5, 2026 at 11:32 am

    Well, yes you can consider it a feature maybe, but what the author is perhaps trying to explain (although not very clearly at least in this one paragraph), is that what actually is happening is this:

    1. "Tora !" is an object of class String (“everything is an object”)
    2. “you can act on it just like any other object“, meaning:
      “you can call any method on it just like any other object”.
      In this case you are calling the method * (multiply).

    So what ACTUALLY is happening is that the "Tora !" String gets called in a fashion like this:

    "Tora ! ".*(3)
    => "Tora ! Tora ! Tora ! "
    

    You see? The operator * is just a method on the String object.

    In many simpler languages operators are actually “baked into” the language itself, and do not operate on the targets as method calls.

    If you’re not used to other languages you might not find it all that remarkable, since in Ruby it’s just a normal everyday thing. You just never need to type 1.+(2), Ruby does it for you automatically when you type 1 + 2.

    So this is what the author wants you to remember – all operators and operations are just essentially method calls on other objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a label that displays inches. I would like to display the number
I am trying to write some variables that convert inches and pounds to centimeters
I want to know the printing size of a string in inches. i.e. what
I have a couple strings like: net_weight_(lbs) net_height_(inches) I need a regular expression that
I am looking to convert pixes to inches and vice versa. I understand that
I have a string containg alphabetic characters, for example: 254.69 meters 26.56 cm 23.36
In inches, e.g. 21' monitor. The app is a standard WinForms app. EDIT: It
I've been developing this site for a while and suddenly today I noticed that
Would it be possible to write a program that can make an image, lets
I have some graphics of size in inches: 4.25 x 6.875 5.5 x 8.5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.