Globale Variable hat keinen globalen Gültigkeitsbereich

<code>supposedlyGlobalVariable := "blah"

ARoutine()
{
   localVariable := "asdf"
   MsgBox, The global variable value is %supposedlyGlobalVariable%.  The local variable value is %localVariable%.
}


^!X:: ;This assigns the hotkey CTRL + ALT + X to run the routine
ARoutine()
return
</code>

Führen Sie den Code aus und das Ergebnis ist:

<code>"The global variable value is .  The local variable value is asdf."
</code>

DasDokumentation Zustände:

Variabler Geltungsbereich und Erklärungen: Mit Ausnahme der lokalen Variablen in Funktionen sind alle Variablen global. Das heißt, ihr Inhalt kann von gelesen oder geändert werdenirgendein Teil des Skripts.

Warum hat meine globale Variable keinen Gültigkeitsbereich innerhalb der Funktion?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage