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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:45:20+00:00 2026-06-06T12:45:20+00:00

We were having this discussion wiht my colleagues about Inner assignments such as: return

  • 0

We were having this discussion wiht my colleagues about Inner assignments such as:

return result = myObject.doSomething();

or

if ( null == (point = field.getPoint()) )

Are these acceptable or should they be replaced by the following and why?

int result = myObject.doSomething();
return result;

or

Point point = field.getPoint();
if ( null == point)
  • 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-06T12:45:22+00:00Added an answer on June 6, 2026 at 12:45 pm

    The inner assignment is harder to read and easier to miss. In a complex condition it can even be missed, and can cause error.

    Eg. this will be a hard to find error, if the condition evaluation prevent to assign a value to the variable:

    if (i == 2 && null == (point = field.getPoint())) ...
    

    If i == 2 is false, the point variable will not have value later on.

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

Sidebar

Related Questions

I was having a discussion about this with a co-worker and we couldn't come
We are having this discussion in our team about code conventions for Java for:
We're having a spirited discussion about this at my workplace. We're talking about user
My coworkers and I were having a discussion about this yesterday. It seems that
We're having this discussion here. Which is better and why? 1) a php file
Me and my colleagues got into this discussion early this morning, and our opinions
I don't know if this has been asked before, but we're having a discussion
I was having this discussion with my friend and realized this might be the
I've been having this discussion with my brother, and it looks like none of
I am having a discussion with someone about the following table that is used

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.