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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:24:02+00:00 2026-06-01T09:24:02+00:00

Note: I am not exactly sure what to name the question, so if someone

  • 0

Note: I am not exactly sure what to name the question, so if someone has a better idea please edit it.

I will jump right into the question, since there isn’t any fore-explaining required.

This code:

!foo = true

generates this warning

warning: found = in conditional, should be ==

I would understand if this was happening after an if or unless statement, but this couldn’t be further away from them (exaggerating). I do realise I could use:

foo = true
!foo

I suppose, the warning isn’t a big deal, but it is a bit irritating that Ruby is assuming I am doing something wrong—when I am not.


Questions:

  • Is this a bug?
  • Can the warning be disabled?

Thanks!

  • 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-01T09:24:03+00:00Added an answer on June 1, 2026 at 9:24 am

    Is legal. Not a bug. The warning can be suppressed.

    You can disable the warning with:

    $VERBOSE = nil
    

    It’s interesting, $VERBOSE is a case where setting something to false does something different than setting it to nil.

    By the way, the other answers, at least initially, tend to assume that Ruby parses the expression as

    (!foo) = true
    

    … but that’s not the case. It is parsed as:

    !(foo = true)
    

    … and so it’s doing exactly what the OP wanted. And there is no specification or ratified standard for Ruby, so if it works in MRI (the reference implementation) then it’s legal.

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

Sidebar

Related Questions

Note: Not sure if this is the right stack, please tell if I should
NOTE: I am not exactly sure how to title or tag this question, so
I'm not sure exactly sure what the correct terminology is for my question so
Not exactly how sure how to title this question, so I hope the title
(Note: This is not a question about what is the best way with code
Note: There was not any question with this kind of problem here or anywhere...
I am not sure exactly is happening here but did figure out that URLLoader.close();
(note this is similar to but not the same as the question I asked
Not sure exactly how to do this since I am not that great at
this is a simple question I am sure, but I have not been able

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.