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.
Tutorialspoint

Tcl Hello World

puts "Hello World!"

proc try {a {b 3}} {
    puts "in Try, the a is $a"  
    set a [expr $b * 2]
    return "The a is $a and b is $b"
}

set msg [try 4]
# set msg "I am the one!"
puts $msg

set A(a) "V1"
set A(b) "V2"
set A(c) "V3"

foreach {k v} [array get A] {
    puts "key : $k ; val : $v"
}

puts [array names A]
# puts [keys $A]
puts [array get A]
puts [array size A]

array set A1 {aa 0 bb 1 cc 20}
foreach {k v} [array get A1] {
    puts "key : $k ; val : $v"
}



Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.