Riverside Learning LABO(Skill/Idea/Code)

よりよいシステムのため工学系と人間系の学習下書きメモ

Trycatch

■finallyがある場合のtry〜catchの正常・異常設定

                                                                        • -

・パターン1

                                                                        • -

main 
{
    try 
    { 
     return 正常終了
     } 
    catch 
    {
    return 異常終了
    }   
    finally
    {
     [ 最後の処理 ] 
    }
}

                                                                        • -
                                                                        • -

・パターン2

                                                                        • -

main 

try 

正常終了のリターンコード設定
  } 
catch
 {
  エラーのリターンコード設定
 } 
finally
{
 [ 最後の処理 ] 
}
return(リターンコード)
 }

                                                                        • -