-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update coding guidelines #3785
Update coding guidelines #3785
Conversation
Minor updates to our coding guidelines
|
||
### 6.5. Private Variables | ||
All private variables shall be declared in a private array. | ||
All private variables shall make use of the `private` keyword on initalization. When declaring a private variable before initalization, usage of the private array syntax is allowed. All private variables must be either initialized using the private key word, or declared using the private array syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or by using params
I guess.
params
is not exclusive to the functions arguments, but is sometimes also used in forEach loops (_x params [...]
), so it might be worth noting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or any array really. It's the same as EXPLODE_N_PVT
macro was.
Added both the bit about params usage for arrays and fixed the missing |
👍 |
Bad: | ||
```sqf | ||
private _areAllAboveTen = true; // <- this is bad, because it can be initalized in the if statement | ||
if (call FUNC(myCondition) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think it was worth to mention, but this line is also missing the same closing parenthesis.
Minor updates to our coding guidelines