Quantcast
Channel: What is the point of finally in a try catch/except finally statement - Stack Overflow
Viewing all articles
Browse latest Browse all 8

What is the point of finally in a try catch/except finally statement

$
0
0

I have used try-catch/except-finally variants in many languages for years, today someone asked me what is the point of finally and I couldn't answer.

Basically why would you put a statement in finally instead of just putting it after the whole try-catch block? Or in other words is there a difference between the following blocks of code:

try{ //a}catch {//b}finally {//c}try{//a}catch{//b}//c

EDIT:
PEOPLE, I know what finally does, I have been using it for ages, but my question is in the above example putting //c in finally seems redundant, doesn't it?


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images