Code Comments
Programming Forum and web based access to our favorite programming groups.Hi Everyone, I am writing a script which created multiple processes. And for error handling, i need to be able to skip a bunch of statements when it happens. proc would probably not work for this as it will give back control to the next line and will not skip them. I need something like the below, wherein i need to be able to skip a few lines when an event occurs. Is this possible. thanks, ram ..code ... ... goto skip ... ... .... skip .... .... .... end
Post Follow-up to this messageTcl does not have gotos. It does have if, while, for, catch and foreach commands. Check them out. ram wrote: > Hi Everyone, > I am writing a script which created multiple processes. And > for error handling, i need to be able to skip a bunch of statements > when it happens. proc would probably not work for this as it will give > back control to the next line and will not skip them. I need something > like the below, wherein i need to be able to skip a few lines when an > event occurs. Is this possible. > > thanks, > ram > > ..code > ... > ... > goto skip > ... > ... > .... > skip > .... > .... > .... > end -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
Post Follow-up to this messageram schrieb:
> Hi Everyone,
> I am writing a script which created multiple processes. And
> for error handling, i need to be able to skip a bunch of statements
> when it happens. proc would probably not work for this as it will give
> back control to the next line and will not skip them. I need something
> like the below, wherein i need to be able to skip a few lines when an
> event occurs. Is this possible.
Error handling can be done with "error", which throws an error string,
and "catch", which catches the error. Look'em up.
Basically, your code should like something like this
if {[catch {
do this
and that
if {foo} {error "Errorcondition" }
other code
} errcode]} {
cleanup
puts "Error was $errcode"
}
Christian
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.