The syntax for replacing list items at specific indices is
lreplace listname firstindex lastindex value1 value2..valuen
Example:
set var {orange blue red green} set var [lreplace $var 2 3 black white] puts $var
Result:
orange blue black white
Jan 4, 2022 | tcl | 0 comments
The syntax for replacing list items at specific indices is
lreplace listname firstindex lastindex value1 value2..valuen
Example:
set var {orange blue red green} set var [lreplace $var 2 3 black white] puts $var
Result:
orange blue black white
Subscribe now to keep reading and get access to the full archive.
Recent Comments