Top "Finally" questions

Questions related to the finally block in try-catch construct.

Return in try & catch versus return in finally?

Is either one of these risky? Is one better? Or is it one of those things you print out and …

c# try-catch return finally
Why do we use finally blocks?

As far as I can tell, both of the following code snippets will serve the same purpose. Why have finally …

java .net finally
try-catch-finally with return after it

I know how try, catch & finally work (for most part), but I have one thing I was wondering: what …

java return try-catch try-catch-finally finally
error while using try with resources in Java

I have this method where I am using try with resources of Java SE 7. private void generateSecretWord(String filename){ try (…

java try-catch-finally finally try-with-resources
In C# will the Finally block be executed in a try, catch, finally if an unhandled exception is thrown?

Another interview question which was expecting a true / false answer and I wasn't too sure. Duplicate In .NET, what if …

c# .net finally
Execute if no exception thrown

I have some code I want to execute if an exception is not thrown. Currently I'm doing this: try: return …

python exception python-3.x try-catch finally
What is the point of finally in a try catch/except finally statement

I have used try-catch/except-finally variants in many languages for years, today someone asked me what is the point of …

exception-handling finally
Property finally is missing in type Promise

I'm pretty sure I'll be able to solve this issue by myself but if it can help somebody else I …

typescript es6-promise finally
Determine if executing in finally block due to exception being thrown

Is it possible to determine if code is currently executing in the context of a finally handler as a result …

c# exception idisposable finally try-catch
Powershell Try Catch and retry?

I have this script #Change hostname [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') Write-Host "Change hostname " -NoNewLine $ComputerName = [Microsoft.VisualBasic.…

loops powershell try-catch finally