MyTetra Share
Делитесь знаниями!
static variables
Время создания: 22.04.2017 19:23
Раздел: AutoHotkey - variables
Запись: xintrea/mytetra_db_mcold/master/base/149287821006o52r747e/text.html на

Static variables

Static variables are always implicitly local, but differ from locals because their values are remembered between calls. For example:



static LoggedLines = 0

LoggedLines += 1 ; Maintain a tally locally (its value is remembered between calls).

global LogFileName

FileAppend, %LoggedLines%: %TextToLog%`n, %LogFileName%


Assume-static mode [v1.0.48+]: A function may be defined to assume that all its variables are static (except its parameters) by making its first line the word "static". For example:




static FirstCallToUs := true ; A static declaration's initializer still runs only once (upon startup).

if FirstCallToUs ; Create a static array during the first call, but not on subsequent calls.


FirstCallToUs := false

Loop 10

StaticArray%A_Index% := "Value #" . A_Index


return StaticArray%WhichItemNumber%


Так же в этом разделе:
MyTetra Share v.0.58
Яндекс индекс цитирования