+ 1

Which loop is known as bottom tested loop and top tested loop ?

Can anyone explain?

9th Jun 2019, 10:40 AM
Parth Lakhani
Parth Lakhani - avatar
3 ответов
+ 3
ChrA means while is top tested? & do....while is bottom tested?
9th Jun 2019, 11:07 AM
Parth Lakhani
Parth Lakhani - avatar
+ 2
Hi. There are loops such as do { // Your code } while(_condition_); where the test for another run of the code in curly braces is done at the end. Usually these loops are ran at least once. The other type would be while (_condition_) {you // Your code } where the condition is evaluated at the beginning. If the condition does not hold (is tested false) from the beginning the code is not executed at all. Hope that helps. C
9th Jun 2019, 11:05 AM
ChrA
ChrA - avatar
+ 1
https://code.sololearn.com/c28B0JNtdQdK/?ref=app See the output of this code. Choice for i to be ten was just random
9th Jun 2019, 12:03 PM
ChrA
ChrA - avatar