Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
set list0 "0 1 2 3 4 5"
set list1 [lappend list0 "6" "7" "8" "9" "10"]
puts "$list1\n";
set i 0
foreach number $list1 {
puts "$number is the $i element in the list\n"
incr i;
}
set a [lindex $list1 5]
set b [lindex $list1 10]
set sum [expr {$a + $b}]
puts " \nthe sum of two element is : $sum"
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more