I'm studying Fortran from the book of Stephen Chapman "Fortran for Scientists and Engineers" (2018).
In page 134, the author wrote this:
Good Programming Practice:
Do not use DO WHILE loops in new programs. Use the more general while loop instead.
This sentence is puzzling me a lot. Is DO-WHILE an unwanted practice? I often find DO-WHILE neater to work with. Is there any disadvantage of using DO-WHILE in terms of speed?
DO-WHILE
INTEGER :: i = -1
DO WHILE (i < 0)
PRINT *, 'Enter a non-negative number:'
READ(*,*) i
END DO
General while loop:
INTEGER :: i = -1
DO
PRINT *, 'Enter a non-negative number:'
READ(*,*) i
IF (i >= 0) EXIT
END DO