[Tutor] A question about None

Phil phillor9 at gmail.com
Sun Aug 22 05:46:27 EDT 2021


On 22/8/21 6:22 pm, Alan Gauld via Tutor wrote:
> The logic semsoverly complex, why not something like:
> while True:
>      value = distance_sensor.get_distance_cm()
>      if not value: continue   # back to the while
>
>      if value > 20:
>         ...
>      elif value < 20:
>         ...
>      if value == 20:
>         ????

Thank you Alan, Mark and dn for your replies. I thought having two 
continue statements was not a good idea but I persisted with that idea. 
The simplified code offered is a far better approach and I should be 
able to sort this out now.

Internet speed at my current location is only in the order of 100 bits 
per second so we'll see if  this reply leaves here.

-- 

Regards,
Phil



More information about the Tutor mailing list