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 6753661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:11:21+00:00 2026-05-26T13:11:21+00:00

As i understand when we add two numbers in ruby a ‘+’ method is

  • 0

As i understand when we add two numbers in ruby a ‘+’ method is called on the current object with parameter as the the next object.

>> 2 + 3
=> 5



>> 2.+(3)
=> 5

How are these two examples same is it possible that we can call methods on objects without the dot operator ? How is it happening in the first example ? if that is the case the could 3 be an method method called on ‘+’ method ? (It doesn’t even make sense)

  • 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-05-26T13:11:21+00:00Added an answer on May 26, 2026 at 1:11 pm

    Ruby knows that + is an operator because the language’s grammar says so. There’s also a unary + operator (that is converted to the +@ method) and the language’s grammar allows Ruby to know which is which. The language definition says that operators are implemented as method calls and specifies which method each operator maps to.

    What you’re asking is the same as asking how o.m a is a call to the m method on o with a as an argument. That’s just how Ruby’s syntax and semantics are defined.

    Operators are functions even in theoretical mathematics. The a + b notation is really just a convenient notation for +(a, b) (where +:R2→R or a function from R×R to R, for example). I think you’re reading too much into the notation and thinking that operators are something special, they’re not, they’re just function calls in computer languages and mathematics alike.

    In short, it works because that’s how Ruby is defined to work.

    As far as

    could 3 be an method method called on ‘+’ method ?

    is concerned, 3 is an argument or parameter to the + method on the Fixnum object 2.

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

Sidebar

Related Questions

I'm trying to understand how you are supposed to add page numbers to the
I understand how to add a jquery-ui tab, and I understand how to select
I'm trying to understand how to add a label with a UISwitch or other
I understand that I cannot add preconditions on an interface implementation. I have to
I don't understand how using a 'challenge token' would add any sort of prevention:
I understand that according to the HTML specification, it's invalid to add custom attributes
While I do understand php, I'm more of a sysadmin than a programmer. Add
Unix's join of two files on a common column requires (as I understand it)
I understand why floating point numbers can't be compared, and know about the mantissa
I have two text fields in which numbers are inputed as strings. I need

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.