tclref.txt 585 B

12345678910111213141516171819202122232425262728
  1. $ tclsh # Tcl interpreter
  2. % set institute "Institute of Mathematical Sciences"
  3. % puts "Institute of Mathematical Sciences"
  4. Institute of Mathematical Sciences
  5. % puts "The institution name is $institute"
  6. The institution name is Institute of Mathematical Sciences
  7. % expr sin(4)
  8. -0.7568024953079282
  9. % set total 1
  10. % set count 10
  11. % puts $count
  12. 10
  13. % while {$count > 0} {
  14. set total [expr $total * $count]
  15. set count [expr $count - 1]
  16. }
  17. % puts $count
  18. 0
  19. # the two commands are equivalent
  20. % set count [expr $count - 1]
  21. % incr count -1 # with no other argument incr adds one
  22. % exit