Posted to tcl by Maximus at Mon Sep 30 10:55:05 GMT 2019view raw

  1. set num "0"
  2.  
  3. proc myNum {} {
  4.  
  5. global num
  6.  
  7. for {set i 0} {$i < 10} {incr i} {
  8. if {[info exists num]} {
  9. set num [expr 1 + $num]
  10. } else {
  11. set num 1
  12. }
  13. }
  14.  
  15. puts $num
  16. }
  17.  
  18. myNum
  19.  
  20. puts "Found: $num"