Java – for loop

A loop statement is useful for executing iterative tasks. Using a loop a program can run a specific code block for multiple times as required. In Java programming language, there are 3 types of loops used. In which for loop is one of the most used loop. Below is the list if loop available. for loop while loop do-while loop Java – for Loop A for loop is the entry-restricted loop. Where a condition is checked before executing the code block. If the condition evaluates to true, the block of…

Read More

C – do…while Loop

C – do…while Loop In a programming language, a loop is useful for running iterative tasks. Using a loop a program can execute code block for multiple times as required. Mainly there are 3 types of loops available in C programming language. Where while loop is one of them. Below is the list if loop available. for loop while loop do-while loop do while Loop A do while loop is similar to while loop. It is exit restricted loops. It means the condition is checked at end of the loop.…

Read More

C – while loop

C – while Loop Statement In a programming language, a loop is useful for running iterative tasks. Using a loop a program can execute code block for multiple times as required. Mainly there are 3 types of loops available in C programming language. Where while loop is one of them. Below is the list if loop available. for loop while loop do-while loop while Loop While loop is also an entry-restricted loop. Where a condition is checked before executing the code block. If the condition evaluates to true, the block…

Read More

C – for loop

C – for Loop Statement A loop is useful for running iterative tasks. Using a loop a program can execute code block for multiple times as required. Mainly there are 3 types of loops available in C programming language. Where for loop is one of them. Below is the list if loop available. for loop while loop do-while loop for Loop A for loop is the entry-restricted loop. Where a condition is checked before executing the code block. If the condition evaluates to true, the block of code is executed…

Read More

Bash – While Loop

While Loop in Bash Similar to for loop, while loop is also entry restricted loop. It means the condition is checked before executing while loop. While loop is also capable to do all the work as for loop can do. Syntax: while [condition] do //programme to execute done #1. Bash – While Loop Example For example, the following loop will be executed 5 times and terminated when the value of variable num will be greater than 5.

#2. Bash – Infinite While Loop Infinite for loops can be also…

Read More

Bash – For Loop

For Loop in Bash In a programming language, a loop is used to repeat the execution of a block of code until the satisfied defined condition. Which is helpful to perform repetitive tasks. Mainly there are 3 types of loops, for, do, and do-while. In this tutorial, we will discuss for loop in shell scripting. The shell scripting also provides for loops to perform repetitive tasks. A basic for loop syntax looks like: Syntax: for VARIABLE in PARAM1 PARAM2 PARAM3 do //for-loop statements done The for loop executes for all…

Read More