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

  • Home
  • SEARCH
  • 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 7999837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:37:01+00:00 2026-06-04T15:37:01+00:00

I came across some results in a program I was writing that confused me.

  • 0

I came across some results in a program I was writing that confused me. It is my understanding parens are not normally needed (i.e. obj.method1.method2 is as good as (obj.method1).method2). In addition all operators are really method calls so I expected them to behave similarly.

So imagine my surprise that "S"+"R".downcase resulted in Sr as did "S".+"R".downcase however "S".send(:+, "R").downcase finally gave me the expected output sr

Is this because the operator shortcuts are treated differently or is there some other mechanic at work here that I am missing?


Edit: The question isn’t about the order of operations that resulted in the answer, that’s obvious. The question was WHY the expression was resolved in that order.

  • 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-04T15:37:04+00:00Added an answer on June 4, 2026 at 3:37 pm

    . has higher precedence than + and is evaluated first. ("S"+"R").downcase works too.

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

Sidebar

Related Questions

I came across some javascript at work today that used jQuery to fetch two
I came across some legacy code that contains a function like this: LPCTSTR returnString()
While maintaining an old product, I came across an error that results in the
I came across a few articles like this one , which suggest that some
I came across a ternary in some code and I am having trouble understanding
I came across some strange results when using Code Coverage for our unit tests.
I came across this while debugging some unit tests that compared a returned single
I came across some MATLAB syntax with a colon that I don't fully understand.
I came across some strange behavior of asp:PlaceHolder , it removes whitespaces between the
Context I came across some code, like this: if( Some_Condition ) throw 0; I

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.