Counter Loop:
Counter loop is a loop which executes statement up to a fixed number of time.
In GW FOR ... NEXT loop is used as counter loop.
Controlled Loop:
Controlled loop is used to extend the statements till a specific condition is satisfied. In GW WHILE ... WEND is used as controlled loop.
while and for loops are entry controlled loops. In these loop structure, the loop statements are executed after the loop condition is checked( at loop entry). Hence if the condition is false, the statements are not executed.
do-while loop is an exit controlled loop. In this loop structure, the loop statements are executed first and then the condition is checked (at loop exit). Hence if the condition is false, the statements are executed once.
You use a count-controlled loop when you specifically want a loop to iterate a pre-determined number of times. You use a flag-controlled loop when you want a loop to iterate an indeterminate number of times until one or more conditions are satisfied. A flag-controlled loop may be infinite if the conditions are never satisfied, or may not execute at all if the conditions are already satisfied.
A while loop evaluates a conditional expression at the start of each iteration. If the conditional expression evaluates false, execution passes to the statement that immediately follows the body of the loop. If the conditional expression evaluates true, the body of the loop executes one iteration. When the end of the loop is reached, or a continue statement is encountered within the body of the loop, control passes back to the while statement where the conditional expression is re-evaluated. If a break statement is encountered within the body of the loop, the loop terminates and control passes to the next statement. If a return statement is encountered within the body of the loop, the loop terminates and control passes to the calling function.while (expression) {// repeats until the expression evaluates false}The braces are optional when the body of the loop is a simple statement. Compound statements must be enclosed in braces.A flag-controlled while loop has a simple conditional expression that evaluates a Boolean value:bool x;// ...while (x==true) { // flag-controlled loop// ...}}The above loop can also be written without the equality operator:while (x) { // flag-controlled loop // ...}Moreover, any integral type (such as int or char) will implicitly convert to a bool such that non-zero values evaluate true and zero evaluates false. As such, any integral type can be used in a flag-controlled loop.
A condition-controlled loop is one that has an indefinite number of iterations; its opposite is the count-controlled loop. Condition-controlled loops execute until some event occurs, which is usually user-initiated. For example, modern programs run an condition-controlled loop similar to the following: while(GetMessage(message,hwnd,0,0)) { ... } This loop continues to execute until there are no messages left (the WM_QUIT message is returned, which has a value of zero). It is impossible to identify before execution the number of times such a loop will run, except during controlled tests, although you can easily identify what conditions will cause it to terminate.
An exit-controlled loop is a loop where the controlling conditional expression is evaluated at the end of each iteration, as opposed to an entry-controlled loop where the expression is evaluated at the beginning of each iteration. The upshot is that an exit-controlled loop always executes at least one complete iteration whereas an entry-controlled loop might not iterate at all: int x = 100; // entry-controlled loop while (x<50) { printf ("%d\n", x++); // won't execute at all because x<50 is false } // exit-controlled loop do { printf ("%d\n", x++); // will execute one time only } while (x<50);
count = count + 1
Difference between field controlled and armature controlled is that field control is open loop and armature current is closed loop.
count-controlled
A Condition-Controlled loop keeps going until a certain condition is met, like say the user clicks a button, or the world ends or something. A Counter controlled loop keeps going until it has run a certain number of times. For example if you create a variable x=0. And then every time your look runs you increase x by 1 (x=x+1), you can tell your loop to keep running until x=5. That way the loop would run 5 times until the *COUNTER* reaches 5. This would be a counter controlled loop
A while loop evaluates a conditional expression at the start of each iteration. If the conditional expression evaluates false, execution passes to the statement that immediately follows the body of the loop. If the conditional expression evaluates true, the body of the loop executes one iteration. When the end of the loop is reached, or a continue statement is encountered within the body of the loop, control passes back to the while statement where the conditional expression is re-evaluated. If a break statement is encountered within the body of the loop, the loop terminates and control passes to the next statement. If a return statement is encountered within the body of the loop, the loop terminates and control passes to the calling function.while (expression) {// repeats until the expression evaluates false}The braces are optional when the body of the loop is a simple statement. Compound statements must be enclosed in braces.A flag-controlled while loop has a simple conditional expression that evaluates a Boolean value:bool x;// ...while (x==true) { // flag-controlled loop// ...}}The above loop can also be written without the equality operator:while (x) { // flag-controlled loop // ...}Moreover, any integral type (such as int or char) will implicitly convert to a bool such that non-zero values evaluate true and zero evaluates false. As such, any integral type can be used in a flag-controlled loop.
A condition-controlled loop is one that has an indefinite number of iterations; its opposite is the count-controlled loop. Condition-controlled loops execute until some event occurs, which is usually user-initiated. For example, modern programs run an condition-controlled loop similar to the following: while(GetMessage(message,hwnd,0,0)) { ... } This loop continues to execute until there are no messages left (the WM_QUIT message is returned, which has a value of zero). It is impossible to identify before execution the number of times such a loop will run, except during controlled tests, although you can easily identify what conditions will cause it to terminate.
The easiest way is to just use a loop variable. For example:var count = 0;for (var i in object) {if (object.hasOwnProperty(i) {count++;}}console.log(count);That will add to the count variable each time through the loop, so at the end it will be a count of the number of times the loop has run.
The for loop is another entry-controlled loop that provides a more concise loop control structure.The general form of the for loop isfor( initialization ; test condition ; increment ){body}Generally this loop is used when the either the no. of loops or the looping condition or the end condition is known.Ex.to count n no. of integers.Hope this will help.
A condition-controlled loop is one that has an indefinite number of iterations; its opposite is the count-controlled loop. Condition-controlled loops execute until some event occurs, which is usually user-initiated. For example, modern programs run an condition-controlled loop similar to the following: while(GetMessage(message,hwnd,0,0)) { ... } This loop continues to execute until there are no messages left (the WM_QUIT message is returned, which has a value of zero). It is impossible to identify before execution the number of times such a loop will run, except during controlled tests, although you can easily identify what conditions will cause it to terminate.
The value of count should be more than max range of the for-loop. e.g. for (index=0;index<n;index++) ....In this case the count (i.e. index) would be more than "n" which is max-range.
An exit-controlled loop is a loop where the controlling conditional expression is evaluated at the end of each iteration, as opposed to an entry-controlled loop where the expression is evaluated at the beginning of each iteration. The upshot is that an exit-controlled loop always executes at least one complete iteration whereas an entry-controlled loop might not iterate at all: int x = 100; // entry-controlled loop while (x<50) { printf ("%d\n", x++); // won't execute at all because x<50 is false } // exit-controlled loop do { printf ("%d\n", x++); // will execute one time only } while (x<50);
An exit-controlled loop is a loop where the controlling conditional expression is evaluated at the end of each iteration, as opposed to an entry-controlled loop where the expression is evaluated at the beginning of each iteration. The upshot is that an exit-controlled loop always executes at least one complete iteration whereas an entry-controlled loop might not iterate at all: int x = 100; // entry-controlled loop while (x<50) { printf ("%d\n", x++); // won't execute at all because x<50 is false } // exit-controlled loop do { printf ("%d\n", x++); // will execute one time only } while (x<50);
Open loop (single cycle) involves a break requiring a restart, easily adapted to closed loop.
It is a type of event controlled loop which is goes on until it strikes a value which is predefined to stop the loop.