It’s been frequently requested that we needed a better way do this:
- 
action: service name=foo state=running 
 register: some_result
 when: x == 3
- 
action: shell echo ‘some random example’ 
 when: some_result.changed
However, before this could not be done easily, as ‘skipped’ tasks (when x was not 3) did not register variables, so you could not access some_result.changed consistently.
I have now fixed the glitch so the above example works.