Scope modifiers: Difference between revisions
Content added Content deleted
(add E description) |
(+ AutoHotkey) |
||
Line 45: | Line 45: | ||
</lang> |
</lang> |
||
This package can be then used only by private siblings of the same parent P. |
This package can be then used only by private siblings of the same parent P. |
||
=={{header|AutoHotkey}}== |
|||
<lang AutoHotkey>singleton = "global variable" |
|||
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++ |
|||
} |
|||
assume_global2() |
|||
{ |
|||
local var1 ; assume global except for var1 (similar to global scope declaration) |
|||
msgbox % singleton |
|||
} |
|||
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 |
|||
else if null |
|||
_%member% := "" |
|||
return (_%member%) |
|||
}</lang> |
|||
=={{header|E}}== |
=={{header|E}}== |