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

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading