+ 2

why do many professional programmers avoid while loops when possible?

opinionated question involving preference and infinity.

18th Oct 2016, 7:14 AM
Joey Hill
Joey Hill - avatar
4 odpowiedzi
+ 4
I should say, you are wrong, the professional programmers use loops allways when is possible, and the -while- where is it suitable. This is the answer, there is several types of loops and every is suitable for some type of algorytmus..
18th Oct 2016, 7:41 AM
Petr Hatina
Petr Hatina - avatar
+ 2
Use a generator. It's like splitting an instantaneous function into pieces [with state retention] so you can watch it run, without all the mucking about running out of memory.
18th Oct 2016, 11:18 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Infinite loops can make your entire program run slowly, because they are constant. There are other reasons, but that one seems to be the most likely solution.
29th Oct 2016, 1:07 PM
Anna
0
any programmer cant avoid while loops!
22nd Nov 2016, 10:05 AM
rasoul norouzi
rasoul norouzi - avatar