Is it bad to do Inner assignments?
coding-style, java
Solution
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.
Problem
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) ```