Difference between revisions of "Language Reference/Terms/Try-catch-finally"

From wiki.visual-prolog.com
 
m (1 revision(s))
(No difference)

Revision as of 15:22, 15 September 2008

The try-catch-finally statement provides a way to handle possible errors that may occur in a given block of code.

TryCatchTerm:
    try Term CatchFinally-list end try
 
CatchFinally: one of
    catch Variable do Trap-Handler
    finally Finally-Handler
 
Handler:
    Term

The following two terms are equivalent:

try
   Body
catch Var do
   Handler1
finally
   Handler2
end try
try
   try
       Body
   catch Var do
       Handler1
   end try
finally
   Handler2
end try