Can you Compare while and do-while?

Answer:

The 'while' statement evaluates its expression at the beginning of the loop, while a 'do while' statement evaluates its expression at the end of the loop.

The 'while' statement might execute no times.

The 'do while' statement will execute at least one time.

It depends on what you want to do, and on how you want to use the side effects, if any, of the expressions in the expression. (Before or after)

First answer by Alex146. Last edit by Alex146. Contributor trust: 419 [recommend contributor recommended]. Question popularity: 1 [recommend question].