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
Global ; assume all variables declared in this function are global in scope
static callcount := 0 ; except this one declared static, initialized once only
Static callcount := 0 ; except this one declared static, initialized once only
msgbox % singleton ; usefull to initialize a bunch of singletons
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)
Local var1 ; assume global except for var1 (similar to global scope declaration)
msgbox % singleton
MsgBox % singleton
}
}


object(member, value = 0, null = 0)
object(member, value = 0, null = 0)
{
{
static ; assume all variables in this function to be static
Static ; assume all variables in this function to be static
if value ; can be used to simulate objects
If value ; can be used to simulate objects
_%member% := value
_%member% := value
else if null
Else If null
_%member% := ""
_%member% := ""
return (_%member%)
Return (_%member%)
}</lang>
}</lang>