alguidelines/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-already-scoped/index.md
2022-02-24 14:45:35 +01:00

41 lines
680 B
Markdown

+++
title = "Variable Already Scoped"
weight = 1400
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++
Do not use scope ''.'' qualifier unnecessarily when a variable is already implicitly or explicitly scoped. It keeps the code simpler.
Bad code
```al
ReturnRcptHeader.SETRANGE(ReturnRcptHeader."Return Order No.","Document No.");
```
Good code
```al
ReturnRcptHeader.SETRANGE("Return Order No.","Document No.");
```
Bad code
```al
WITH ChangeLogSetupTable DO BEGIN
...
IF ChangeLogSetupTable.DELETE THEN
...
END;
```
Good code
```al
WITH ChangeLogSetupTable DO BEGIN
...
IF DELETE THEN
...
END;
```