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 a "two words"
set b $a
puts $a
puts "Hello, World !"
set a 22
set b 33
puts [expr $a+$b]
set b 5
expr [expr $b-3]
set A(1,1) 10
set A(1,2) 11
array names A
proc proc_name {formal parameters} {
statement 1
statement 2
.
.
return
}
proc proc_a {} {
set c "C insode proc_a"
puts $c
return
}
proc plus { a,b } {
expr $a+$b
return
}
proc proc_a {a,b,c} {body of procedure}
return
}
proc proc_b b {body of procedure}{
return
}
proc proc_a {} {
set c "C incide proc_a"
puts $c
return
}
proc proc_b {} {
set c "C incide proc_b"
puts $c
set c "C Outside proc_a and proc_b"
proc_a
proc_b
puts $c
return
}
#!/usr/bin/tclsh
set a 21
set b 10
set c [expr $a + $b]
puts "Line 1 - Value of c is $c\n"
set c [expr $a - $b]
puts "Line 2 - Value of c is $c\n"
set c [expr $a * $b]
puts "Line 3 - Value of c is $c\n"
set c [expr $a / $b]
puts "Line 4 - Value of c is $c\n"
set c [expr $a % $b]
puts "Line 5 - Value of c is $c\n"