There is a try/catch/finally
block within the for
or foreach
loop.
What will happen if there is a break
statement within the try
block?
Will finally
block be executed?
Yes, finally blocks hit even if you have a jump statement such as break
.
Typically, the statements of a finally block run when control leaves a try statement.The transfer of control can occur as a result of normal execution, of execution of a break, continue, goto, or return statement, or of propagation of an exception out of the try statement.