While loop:
The syntax of while loop in tcl is as
while {text condition } {
body of loop
}
Example :
set x 3
while {$x <6} {
incr x
puts $x
}
here the condition is ist checked and then inside loop value of x is increment by 1. when value of x becomes 6, then condition becomes false and the loop terminates.
The syntax of while loop in tcl is as
while {text condition } {
body of loop
}
Example :
set x 3
while {$x <6} {
incr x
puts $x
}
here the condition is ist checked and then inside loop value of x is increment by 1. when value of x becomes 6, then condition becomes false and the loop terminates.
No comments:
Post a Comment