how to increment eacl element in a list ?
eg: incrlist {1 2 3}
=>2 3 4
Answer Posted / yatanti
set incrlist { 1 2 3 }
foreach element $incrlist {
set new_element [ expr $element + 1 ]
lappend new_incrlist $new_element
}
puts $new_incrlist
Is This Answer Correct ? | 18 Yes | 3 No |
Post New Answer View All Answers