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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:48:55+00:00 2026-06-19T00:48:55+00:00

Rubymine flags the variable found as potentially undefined. I thought the answer would be

  • 0

Rubymine flags the variable found as potentially undefined. I thought the answer would be to move the variable found outside the begin but I then go into a tight loop that never exits. I am sure this is a block scoping issue but lack the ruby experience to realise what the issue is. I am assuming that this is being flagged because found is declared inside the begin, so the question here is.. is this valid code or is Rubymine’s inspector wrong in this instance ?

begin
  found = false
  @some_collection.keys.each do |key|
    found = evaluate_collection(@some_collection[key], key) unless found
  end
end while found
  • 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-19T00:48:57+00:00Added an answer on June 19, 2026 at 12:48 am

    According to the rubyspec for while:

     it "executes code in containing variable scope" do
        i = 0
        while i != 1
          a = 123
          i = 1
        end
    
        a.should == 123
      end
    

    As begin...end while bool is just another form of a while statement, it also executes in the containing variable scope:

    begin
      found = 'asdf'
    end while false
    puts found
    

    Will output asdf

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

Sidebar

Related Questions

I'm using JetBrains Rubymine for developing Rails applications. It's a great IDE but unfortunately
I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I installed ruby 1.9.3 w/ rubyinstaller-1.9.3-p194.exe, and then installed RubyMine right after, as per
I'm wondering if anyone has managed to integrate SASS into their RubyMine environment, and
I know it is popular to hate on IDEs, but I've been using rubymine
I just installed the Vim plugin for RubyMine, but I cant figure out where
Found this Best Practice and it's even got inspection in RubyMine: Only one or
My IDE, RubyMine, says this is potentially incorrect: function update_top_up_prices_via_localStorage(){ var index = localStorage.getItem(volxs);
I may be way off base here, but RubyMine appears to be spellchecking my
I have installed RubyMine on Mac but my development environment for Ruby and Rails

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.