I want to list the increments in "$ i" of the loop for variable in '[list ]' mode. For then, I could calculate the values with '[expr ]'.
I will leave here a didactic example, to simplify the idea. To look:
set i 1
while {$i <= 9} {
global value
set lst [puts -nonewline "$i "]
set value [list $lst]
incr i
}
global value
# puts [expr [lindex $value 0] + [lindex $value 1]]
puts "\n$value"
My difficulty is in keeping these successive increments within a variable.
In this mode:
set value $i
Only the last increment / number is added in the variable.
As I said earlier, I need to store these numbers numbers to later calculate. Something like:
puts [expr [lindex $value 0] + [lindex $value 1]]
Warning - "For didactic purposes here, I made an example with ordinal number and sequence of '1 - 9'. But for my purpose that I am working at the moment .. I am receiving random numbers from one or more decimal places, I leave it very clear to the colleagues who can help do not suggest writing the list by hand. Once I am extracting lines from a file that contains 1000 lines from which it is numbered, that means that, I am working with dynamic and non-sequential number as it is in the question. I only made '1-9' to be able to exemplify the issue. After receiving the answer myself I will adapt the solution to my script.tcl."