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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:40:37+00:00 2026-05-25T20:40:37+00:00

I find myself preferring if not rather than unless . Is there a proper

  • 0

I find myself preferring if not rather than unless. Is there a proper way to write that sort of condition? How do people generally feel about unless?

  • 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-25T20:40:37+00:00Added an answer on May 25, 2026 at 8:40 pm

    I hope this helps you: https://github.com/rubocop-hq/ruby-style-guide#if-vs-unless

    Prefer unless over if for negative conditions (or control flow ||).

    # bad
    do_something if !some_condition
    
    # bad
    do_something if not some_condition
    
    # good
    do_something unless some_condition
    

    I personally agree with what’s written there choosing unless something over if !something for modifiers and simple ones and when there’s an else prefer if.

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

Sidebar

Related Questions

I find myself repeating business-rules too much in my LinqToEntities when querying. That's not
I find myself wanting to write a routine that will operate on both volatile
I find myself writing code that looks like this a lot: set<int> affected_items; while
I find myself constantly pressing ctrl-z to undo the automatic formatting that happens in
I find myself writing code that looks something like this: $(document).ready(function(){ updateStuff(); $('select').change(function(){ updateStuff();
I find myself having this sort of pattern over and over: variable = try:
I find myself creating Add/Edit/Delete/List GUI's so often that I'm sick and tired of
I find myself wanting to delete rows older than (x)-days on a rolling basis
I find myself writing delegates occasionally for really simple functions (take no arguments and
I find myself needing to store public key certificates, and a single private key

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.