VBScriptでプログラミング中機能の開始前に多くのエラーチェックコードを関数に書き込んでいます。だから、いくつかの前提条件が満たされていない場合は、「Exit Function」を実行します。したがって、たとえば:複数の出口点を持つ関数:それは良い方法ですか?
public fucnton func
if not condition then
func = -1
exit function
End If
'Other conditions with exit functions
'Then long code goes here
..........
..........
..........
func = res
End Function
したがって、私は複数の点で機能を終了することができます。これは良い方法ですか?この場合、私は声明
はたぶん書くことが良い場合の長い他の枝を取得します:
public fucnton func
if not condition then
func = -1
Else
'Then long code goes here
..........
..........
..........
End If
End Function
してください、あなたの考えを共有しています。