################################################################ # proc nextRandom {}-- # Add one to the global variable var # Arguments # NONE # # Results # global var is modified # proc nextRandom {} { # var exists in global scope global var set var [expr {$var + int(rand()*10)}] } set var 1 expr srand(0) label .l1 -textvar var button .b1 -text "Incr" -command nextRandom grid .l1 grid .b1