A mostly reasonable approach to AutoHotkey
- All variables should be
camelCase
orsnake_case
- Constants should be in
ALLCAPS
- Should be
camelCase
- Should be on own line
- Should be proceeded by a space
- Should be mostly enclosed in parenthesis:
if (var)
if (func())
if (!var)
if (!func())
if (var == 1)
if (var != 1)
if (var == 1 || var == 2)
if !(var == 1 || var == 2)
Should be used whenever possible.
No-brace if
statements are allowed, as long as the content is actually one line long:
; Good!
if (condition)
MsgBox, yes
; Bad!
if (condition1)
if (condition2)
MsgBox, no
should follow this template
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 ---
externalUseMethod() {
return 1
}
_internal_UseMethod() {
return 1
}
; --- Nested Classes ---
class nested1 {
}
class nested2 {
}
}