Skip to content

For Loop

A For loop is a repetition control structure that allows you to efficiently write a loop that needs to be executed a specific number of times. This is useful when you know how many times a task needs to be repeated.

In HuLoop, FOR command is used to start FOR loop and ENDFOR is used to mark the end of FOR loop. All the steps inside FOR and ENDFOR are the block of steps which will be used in the FOR loop iteration.

Syntax:

For(startindex=0,endindex=5,incrementby=1)

where,

startindex: It indicates the starting condition of the loop.

endindex: It indicates the end condition of the loop.

incrementby: It indicates the increment count of the loop.

 

Commands that can be used inside FOR loop:

CONTINUE Command: The continue keyword can be used in any of the loop control structures. It causes the loop to immediately jump to the next iteration of the loop. In a for loop, the continue keyword causes control to immediately jump to the next iteration of the conditional statement.

Syntax:

Example:

   

   

BREAK Command: Break command is used to terminate the loop. When the break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.

Syntax:

Example:

Back To Top