I can't give you a hard reason. I guess when I learned C all examples were like c=yesno?1:2. So I guess I stuck to it and never thought about triggering an action with side effects that way.
So as an example of doing both, consider following Java pseudocode (simples example that comes to my mind now):
Foo value = someCondition()
? map1.computeIfAbsent("key", defaultValueProvider)
: map2.computeIfAbsent("key", defaultValueProvider);
This both gets a value and changes state of the map; which map is queried/altered is determined by the condition. I personally don't mind such code, and prefer it to if/else version. Foo value = ( someCondition() ? map1 : map2 ).computeIfAbsent("key", defaultValueProvider);
Or some kind of moral equivalent?For clarity, let's rewrite it as:
Foo value = someCondition()
? map1.computeIfAbsent("key", defaultValueProvider)
: list1.get(42);