[Gambas-user] question about CATCH

Charlie Reinl Karl.Reinl at ...9...
Thu Jun 18 23:14:35 CEST 2009


Am Donnerstag, den 18.06.2009, 15:31 -0500 schrieb M0E Lnx:
> So I've been looking at this http://gambasdoc.org/help/lang/catch
> 
> My question is... Can the sub/function continue after catch has been
> declared, or should catch always be the last thing in the sub?
> 
> For instance
> 
> PUBLIC SUB Save_a_file()
> DIM sStr AS String
> 
> File.Save("/tmp/test",sStr)
> CATCH
> PRINT "Error saving file"
> 
> ' Can I still have code here... after the catch, or is everything
> after CATCH considered to be executed only after an error?
> END

Salut ,

all between  CATCH and END is executed only after an error.
I have not tested if FINALLY came between!

If you have to do something more use FINALLY 

FINALLY ' Always executed, even if a error is raised (as the )
-- 
Amicalment
Charlie





More information about the User mailing list