Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How can i skip lines under certain conditions
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

Report this thread to moderator Post Follow-up to this message
Old Post
ram
04-03-08 12:58 AM


Re: How can i skip lines under certain conditions
Tcl 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|
+------------------------------------------------------------------------+

Report this thread to moderator Post Follow-up to this message
Old Post
Gerald W. Lester
04-03-08 12:58 AM


Re: How can i skip lines under certain conditions
ram 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

Report this thread to moderator Post Follow-up to this message
Old Post
Christian Gollwitzer
04-03-08 12:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Tcl archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:24 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.