Why does this “finally” execute?

前端 未结 8 921
故里飘歌
故里飘歌 2020-12-14 19:02

If you run the code below it actually executes the finally after every call to the goto:

    int i = 0;
Found:
    i++;
    try
    {
        throw new Exc         


        
8条回答
  •  太阳男子
    2020-12-14 19:25

    Because a finally statement is expected to execute after leaving the try (or catch when an exception is caught). This includes when you make your goto call.

提交回复
热议问题