on writing a while loop for rolling two dice
Hope Rouselle
hrouselle at jevedi.com
Sat Sep 4 15:52:41 EDT 2021
"Michael F. Stemper" <michael.stemper at gmail.com> writes:
> On 04/09/2021 08.53, Hope Rouselle wrote:
>> Chris Angelico <rosuav at gmail.com> writes:
>
>>> And at this point, it's looking pretty much identical to the for loop
>>> version. Ultimately, they're all the same and you can pick and choose
>>> elements from each of them.
>> I see. That's why C must have added the do-while, but yeah --- it's
>> not
>> really worth it.
>
> Kernighan and Ritchie agree(d) with you. Per _The C Programming
> Language__:
> Experience shows that do-while is much less used that while
> and for.
>
> (Second edition, Section 3.6, page 63)
Special thanks for the reference! Here's what they say on the first
edition.
``As might be expected, do-while is much less used than while and for,
accounting for perhaps five percent of all loops.'' (First edition,
section 3.6, page 59.)
They looked into a sample and decided to remove the statistic. :-)
More information about the Python-list
mailing list