+ 2

What is Pretest loop? Can you give example

pretest loop

13th Dec 2016, 1:02 PM
Irah Singson
Irah Singson - avatar
5 odpowiedzi
+ 6
Pretest loop runs zero(0) or more times. while (condition) {  /* ... */ } Post test loop runs one(1) or more times but at least once. do {  /* ... */ while (condition);
14th Dec 2016, 9:33 AM
Iván
Iván - avatar
+ 1
The pretest loop checks the condition and, if true, executes the statements in its body. For example i=0; while (i<3) { Console.WriteLine(i); i++; } This will output 1 1 1 but next code: i=4; while (i<3) { Console.WriteLine(i); i++; } has no any outputs.
13th Dec 2016, 1:43 PM
Саша Савчук
Саша Савчук - avatar
+ 1
Thanks!!
13th Dec 2016, 3:34 PM
Irah Singson
Irah Singson - avatar
0
Pretest and posttest loops examples
27th Oct 2019, 5:42 PM
srinivasarao kamisetty
srinivasarao kamisetty - avatar
0
26th May 2020, 3:16 PM
Hayden Dominic NewtonMays
Hayden Dominic NewtonMays - avatar