<@U0BRK9HC5> &gt; You can also use explicit comp...
# stdlib
d
@gildor
You can also use explicit comparison of Boolean:
if (flag1 && (flag2 || someFlag == true))
More clean and native then elvis or extension function
Well, this would produce a different behavior compared to my examples. In my case
someFlag.orTrue()
would resolve to
true
when
someFlag == null
, but in your example
someFlag == true
would resolve to
false
if this flag is null. I.e.
.orTrue()
and
.orFalse()
allow me to finetune behavior of null boolean values. This is rarely needed, but there are cases when this helps... Otherwise your suggestion in certainly nicer 🙂