9 Mar 2020 9 Mar '20
On 2020-03-09 14:16, David Mertz wrote:
This isn't a terrible use of the walrus operator either.
if blue_20 := (color==BLUE and count==20) or red_5 := (color==RED and count%5==0) rotate_the_wheel() # Common to the two sub-conditions if blue_20: # First sub-condition set_signal() if red_5: # Second sub-condition clear_signal() proc_post_rotate() # Common to the two sub-conditions
The problem there is that if the first part of the condition is true, the second part won't be evaluated, so red_5 won't be set.