Last active
December 25, 2015 04:19
-
-
Save rssh/6916091 to your computer and use it in GitHub Desktop.
Implementation fo do/wile in tcl (fragment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc do {body whileword condition} { | |
global errorInfor errorCode | |
if {![string equal $whileword while]} { | |
error "should be \"do body while condition\"" | |
} | |
while {1} { | |
set code [catch {uplevel 1 $body} message] | |
if { !ok( $code) } { | |
return handleBreak($code, $body, $message) | |
} | |
} | |
if {![uplevel 1 [list expr $condition]]} {break} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment