基本的な例外処理の方法を知っています。したがって、「try except」メソッドを使用してゼロ除算でメッセージを発生させることができます。
私がやりたいことは、このエラーの原因となっている変数を見つけて、実行時にその値を変更することです。
例:
procedure Calculate();
var
a, b, c : Double;
begin
try
a := 4; //suppose i take this value from user and he enters 4
b := 0; //suppose i take this value from user and he enters 0
c := a/b;
ShowMessage(FloatToStr(c));
except
on E : EZeroDivide do
begin
ShowMessage('Exception message = '+E.Message);
//i am not sure how to identify that its variable 'b' that is causing the error and has to be changed by a default value
get(E....errorVaraiable);
E....errorVaraiable := 0.00001;
c := a/E....errorVariable;
ShowMessage(FloatToStr(c));
end;
end;
お願いします、誰かこれで私を助けてくれますか?