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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:03:51+00:00 2026-05-25T01:03:51+00:00

Occasionally, I will write some code with way more parentheses than I like. if(!(new

  • 0

Occasionally, I will write some code with way more parentheses than I like.

 if(!(new Day((((new Date()) / millisecondsPerDay) % 75)) instanceof oldDay))) { 
    // Bonus points if that condition made any sense to you
 }

It is hard to keep track of how many parentheses I need to put, especially when I’m not using an IDE that immediately tells me when something is wrong. In fact, I bet the above example doesn’t match the parentheses correctly. I’ve been pegged with errors from death by parentheses more than I would like to admit.

I was wondering if there was a way to circumvent this. What techniques can I use to avoid having to wrap things with so many parentheses?

Are there any languages with a mechanism that prevent the need for so many parentheses? For example, I thought adding special characters that automaticall close parentheses and one that automatically opens them might help. (< and > in the following example)

if(!(new Day<new Date()) / millisecondsPerDay) % 75> instanceof oldDay>
  • 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-25T01:03:52+00:00Added an answer on May 25, 2026 at 1:03 am

    One viable alternative is to precompute the parenthesized values before the conditional loop. Take your code for example:

    if(!(new Day((((new Date()) / millisecondsPerDay) % 75)) instanceof oldDay))) { 
        // Bonus points if that condition made any sense to you
     }
    

    Let’s start breaking it up.

    Date d1 = new Date();
    var factor1 = (d1 / millisecondsPerDay ) % 75;
    Day day1 = new Day (factor1);
    
    if (!day1 instanceof oldDay) {
    // do something
    }
    

    Remember that code is written for humans to read and only afterwards for machines to execute. If you find giant conditionals, then start preprocessing them and break it up. If it takes more than a second to figure out what your condition is checking, then it’s probably too long.

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

Sidebar

Related Questions

I'm writing some documentation that will occasionally include C# or C++ code snippets. In
Currently I have some code to replace strings in a file that looks like
I have a batch file that calls various commands, some of which will occasionally
I am running a short bit of code that will occasionally (very rarely) Access
Occasionally I will know that there is a .NET Framework function that returns a
I have a table of transactions which will occasionally have duplicate entries. If/When an
Occasionally, on a ASP (classic) site users will get this error: [DBNETLIB][ConnectionRead (recv()).]General network
Occasionally working in Windows Vista the O.S. will desaturate the screen, rendering all colors
Occasionally in our lab, our postgres 8.3 database will get orphaned from the pid
Occasionally, I've come across a webpage that tries to pop open a new window

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.