Foreach command used to execute tcl scripts for every element of one or more lists. The basic syntax is below :
foreach varname list script
To iterate on a list and show element value on screen :

A Computer Person Journey
Foreach command used to execute tcl scripts for every element of one or more lists. The basic syntax is below :
foreach varname list script
To iterate on a list and show element value on screen :

To add new element to tcl list there are 2 command linsert and lappend.
Lappend is command to append new elements to the end of variable containing list.
Linsert is command to return new list with new elements inserted before index of passed to the command.
Some examples : Continue reading “Tcl list operation : lappend & linsert”