Exception handling syntax: Difference between revisions

Content deleted Content added
Added Objective-C
Line 172:
 
===[[Python (programming language)|Python]]===
f = None
try:
f = file("aFileName")
f.write(could_make_error())
except IOError:
print "Unable to open file"
except: # catch all exceptions
print "Unexpected error"
finally: # clean-up actions
else: # no exception was raised
tryif f:
f.writeclose(could_make_error())
finally: # clean-up actions
f.close()
 
===[[Objective Caml|OCaml]]===