# AutoHotkey Formatting Guidelines Global Variables: * Should be constants, in `ALL_CAPS` * Or variables prefixed with `_underscore` Constant values should be in `ALL_CAPS` other variables should be `snake_case` or `camelCase` Functions and Methods should be `PascalCase` if statements should follow these formats: `if var` `if func()` `if !var` `if !func()` `if (var == 1)` `if (var != 1)` `if (var == 1 || var == 2)` `if !(var == 1 || var == 2)` Braces must be placed according to allman's styling. One-True-Brace is not acceptable. No-brace if statements are allowed, often preferred, as long as the content is actually one line long: ```ahk ; Good! if (condition) MsgBox, yes ; Bad! if (condition1) if (condition2) MsgBox, no ; Good! if (condition1) { if (condition2) MsgBox, yes } ``` Classes should follow this template: ```ahk class Name { ; --- Static Variables --- static CONSTANT := 1 ; --- Instance Variables --- external_use := 1 _internal_use := 1 ; --- Properties --- external[] { get { return this._internal_use } } ; --- Static Methods --- Method() { return 1 } ; --- Constructor, Destructor, Meta-Functions --- __New() { } __Delete() { } ; --- Instance Methods --- _Internal_Use_Method() { return 1 } External_Use_Method() { return 1 } ; --- Nested Classes --- class Nested1 { ; Contents } class Nested2 { ; Contents } } ```