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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:36:08+00:00 2026-05-17T01:36:08+00:00

if the code is do_more ||= true then when false is passed in, it

  • 0

if the code is

do_more ||= true

then when false is passed in, it becomes

do_more = false || true

and therefore will still be true. So this is one case where foo ||= default_value won’t work? In this case it will need to be

do_more = true if !defined? do_more

?

  • 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-17T01:36:09+00:00Added an answer on May 17, 2026 at 1:36 am

    More generally, foo ||= default_value never works if a valid value for foo is false.

    foo ||= default_value is only a valid pattern when all valid values are interpreted as boolean TRUE.

    Your statement of do_more == true if !defined? do_more should use the assignment operator, I presume a typo: do_more = true if !defined? do_more

    Maybe better would be do_more = true unless defined? do_more

    That looks ok to me, but you need to test to ensure that it works correctly.

    If your param is coming in from an HTML form, then the undefined case is actually a zero length string, “”. If that is your situation, then you’d want:

    do_more = true if do_more == ''

    I’d also suggest a comment # set default

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

Sidebar

Related Questions

Okay, I implemented this SO question to my code: Return True or False Randomly
what behaviour can I expect when I run this code: do while(testA) { //
I have this delphi code that basically download a file (using Delphi 2010 +
All, this is my code //declare string pointer BSTR markup; //initialize markup to some
Consider the following simple code to create a typesafe equals. This first section allows
At this present point in time I have some code that does the following:
Code is much more precise than English; Here's what I'd like to do: import
What exactly does putting extern C into C++ code do? For example: extern C
I have been trying to find out why the following lines of code do
What is machine learning ? What does machine learning code do ? When we

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.