CodeCop Warning AA0206
The value assigned to a variable must be used.
Description
The value assigned to a variable must be used, otherwise the variable is not necessary.
Reason for the rule
Unused variable can be confusing for the reader and can cost performance to the system.
Bad code example
procedure AddEntities@1(FilterStr@1000 : Text[250])
var
Vendor@1001 : Record Vendor;
Count@1002 : Integer;
begin
Count := 0;
Vendor.SETFILTER("No.",FilterStr);
if Vendor.FINDSET() then
repeat
"User ID" := USERID();
"Vendor No." := Vendor."No.";
If Vendor.Insert() THEN;
until Vendor.NEXT() = 0;
end;
Good code example
procedure AddEntities@1(FilterStr@1000 : Text[250])
var
Vendor@1001 : Record Vendor;
begin
Vendor.SETFILTER("No.",FilterStr);
if Vendor.FINDSET() then
repeat
"User ID" := USERID();
"Vendor No." := Vendor."No.";
if Vendor.INSERT() then;
until Vendor.NEXT() = 0;
end;
Good and bad practices for fixing the rule
Remove the variable or make use of it if not using it was a mistake.
See Also
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示