Skip to content

Instantly share code, notes, and snippets.

@rssh
Last active December 25, 2015 04:19
Show Gist options
  • Save rssh/6916091 to your computer and use it in GitHub Desktop.
Save rssh/6916091 to your computer and use it in GitHub Desktop.
Implementation fo do/wile in tcl (fragment)
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