rspec/rules/S1871/python/compliant.adoc

10 lines
255 B
Plaintext
Raw Normal View History

2023-10-24 14:02:02 +02:00
If the same logic is needed for both instances, then the conditions should be combined.
[source,python,diff-id=1,diff-type=compliant]
----
if (0 <= a < 10) or (20 <= a < 50):
do_first()
do_second()
elif 10 <= a < 20:
do_the_other_thing()
----