Tcl : for command

For command used on tcl to create looping with syntax below :

for start test next command

for command have 4 parameter. The first parameter is start block where we set an initial value to a variable (usually using set command). Second parameter is test block where we test a variable or condition(will be tested using expr command). The third parameter is next block which usually used to change variable value (can use incr command). The fourth parameter is command which will be executed in loop.

Basic example below , using i as variable :

The fourth parameter (command) can span multiple command, can also contain another nested for command.

Exercise done ! Bye.

Leave a Reply

Your email address will not be published. Required fields are marked *