Jump to content

Exceptions: Difference between revisions

no edit summary
No edit summary
Line 1:
{{task}}
==[[Python]]==
[[Category:Python]]
 
===try-except-finally-else===
 
'''Interpreter''': Python 2.5
 
Before Python 2.5 it was not possible to use finally and except together.
 
try:
foo()
except TypeError:
bar()
finally:
baz()
else:
# no exception occurred
quux()
 
==[[C plus plus|C++]]==
[[Category:C plus plus]]
 
C++ has no finally construct. Instead you can do this in the
Line 50 ⟶ 34:
}
}
 
==[[Python]]==
[[Category:Python]]
 
===try-except-finally-else===
 
'''Interpreter''': Python 2.5
 
Before Python 2.5 it was not possible to use finally and except together.
 
try:
foo()
except TypeError:
bar()
finally:
baz()
else:
# no exception occurred
quux()
79

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.