Loops
When writing code, you may want the same block of code to run over and over again. Instead of adding several almost equal code-lines in a script, we can use loops to perform a task like this.The while Loop
The while loop executes a block of code as long as the specified condition is true.Syntax:
while (condition is true) {
code to be executed;
}
code to be executed;
}
If the condition never becomes false, the statement will continue to execute indefinitely.
No comments:
Post a Comment