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

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. The do while loop…

Read More

C – 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 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 of code is executed and…

Read More

C – for loop

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 and if the condition evaluates…

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 As any other programming language, shell scripts also support for loops to do the repetitive tasks. Read this tutorial to understand uses of for loop with examples. Syntax: for VARIABLE in PARAM1 PARAM2 PARAM3 do // scope of for loop done for loop executes for each parameter once defined. The VARIABLE is initialized with the parameter’s value which can be accessed in inside the for loop scope. These parameters can be any number, string etc. #1. Bash – For Loop Example Check below basic for loop…

Read More