1.

What Are Loops And Explain Three Different Methods Of Loops In Brief?

Answer»

Loops are the ones, which involve repeating some portion of the program/script either a specified number of times or until a particular condition is being satisfied.

3 methods of loops are:

For loop – This is the most commonly used loop. For loop allows specifying a list of values which the control variable in the loop can TAKE. The loop is then executed for each VALUE mentioned in the list.

While loop – This is used in a program when we want to do something for a fixed number of times. While loop gets executed TILL it returns a zero value.

Until loop – This is similar to while loop EXCEPT that the loop EXECUTES until the condition is true. Until loop gets executed at least once till it returns a non-zero value.

Loops are the ones, which involve repeating some portion of the program/script either a specified number of times or until a particular condition is being satisfied.

3 methods of loops are:

For loop – This is the most commonly used loop. For loop allows specifying a list of values which the control variable in the loop can take. The loop is then executed for each value mentioned in the list.

While loop – This is used in a program when we want to do something for a fixed number of times. While loop gets executed till it returns a zero value.

Until loop – This is similar to while loop except that the loop executes until the condition is true. Until loop gets executed at least once till it returns a non-zero value.



Discussion

No Comment Found