Scope modifiers: Difference between revisions
Content deleted Content added
+ AutoHotkey |
m →{{header|AutoHotkey}}: Minor indentation and casing edit |
||
Line 50: | Line 50: | ||
assume_global() |
assume_global() |
||
{ |
{ |
||
Global ; assume all variables declared in this function are global in scope |
|||
Static callcount := 0 ; except this one declared static, initialized once only |
|||
MsgBox % singleton ; usefull to initialize a bunch of singletons |
|||
callcount++ |
callcount++ |
||
} |
} |
||
Line 58: | Line 58: | ||
assume_global2() |
assume_global2() |
||
{ |
{ |
||
Local var1 ; assume global except for var1 (similar to global scope declaration) |
|||
MsgBox % singleton |
|||
} |
} |
||
object(member, value = 0, null = 0) |
object(member, value = 0, null = 0) |
||
{ |
{ |
||
Static ; assume all variables in this function to be static |
|||
If value ; can be used to simulate objects |
|||
_%member% := value |
_%member% := value |
||
Else If null |
|||
_%member% := "" |
_%member% := "" |
||
Return (_%member%) |
|||
}</lang> |
}</lang> |
||