(The boolean case is a an aggregate, the second one only reassigns if no value is assigned, so I would use both. In contrast the example of yours I referred to wrote the value of foo every line without aggregating - this is what I found non-optimal... :-)  )

On 28/07/2020 12:30, Jochen Theodorou wrote:
On 27.07.20 18:13, MG wrote:

I am actually using this style quite often, because of a lack of good
alternatives. In the groovy code base you will find several places
looking like this:

foo = foo || m1()
foo = foo || m2()
foo = foo || m3()
foo = foo || m4()

or

foo = m1()
if (foo == null) foo = m2()
if (foo == null) foo = m3()
if (foo == null) foo = m4()

depending on if foo is a boolean or not


Reply via email to