<blocksapp="Snap! 6.0 beta, https://snap.berkeley.edu"version="1"><block-definitions="create %'scope' var %'names'"type="command"category="variables"><commentx="0"y="0"w="146"collapsed="false">This block creates new variables on the selected scope: global (for all sprites), sprite (for this sprite only) or script (only for that blocks stack) with the names given (in 'names' list).

If there is already a variable with that name in that scope, it does nothing: no errors and no overwrites.</comment><header></header><code></code><translations>pt:cria as variáveis _ _
ca:crea les _ variables _
es:crear las _ variables _
de:erstellen _ var _
</translations><inputs><inputtype="%s"readonly="true">global<options>global
sprite
script</options></input><inputtype="%mult%txt"></input></inputs><script><blocks="doIfElse"><blocks="reportEquals"><blockvar="scope"/><l>script</l></block><script><blocks="doForEach"><l>each item</l><blockvar="names"/><script><blocks="doRun"><blocks="reportJSFunction"><list><l>varName</l><l>proc</l></list><l>if ((typeof varName) != "string" || varName === "") {
 throw new Error("name isn't a string: " + varName);
}
if (!proc.homeContext.variables.vars[varName]) proc.homeContext.variables.addVar(varName);</l></block><list><blockvar="each item"/></list></block></script></block></script><script><blocks="doDeclareVariables"><list><l>global</l></list></block><blocks="doIfElse"><blocks="reportEquals"><blockvar="scope"/><l>sprite</l></block><script><blocks="doSetVar"><l>global</l><blocks="reportBoolean"><l><bool>false</bool></l></block></block></script><script><blocks="doSetVar"><l>global</l><blocks="reportBoolean"><l><bool>true</bool></l></block></block></script></block><blocks="doForEach"><l>each item</l><blockvar="names"/><script><blocks="doRun"><blocks="reportJSFunction"><list><l>varName</l><l>global</l><l>proc</l></list><l>if ((typeof varName) != "string" || varName === "") {
 throw new Error("name isn't a string: " + varName);
}
if (global && !proc.homeContext.variables.parentFrame.parentFrame.vars[varName]) this.addVariable(varName, true);
if (!global && !proc.homeContext.variables.parentFrame.vars[varName]) this.addVariable(varName, false);</l></block><list><blockvar="each item"/><blockvar="global"/></list></block></script></block><blocks="doRun"><blocks="reportJSFunction"><list></list><l>var ide = this.parentThatIsA(IDE_Morph);
ide.flushBlocksCache('variables'); // b/c of inheritance
ide.refreshPalette();</l></block><list></list></block></script></block></script></block-definition><block-definitions="delete var %'names'"type="command"category="variables"><commentx="0"y="0"w="217"collapsed="false">This block deletes all the variables with the names given (inside input list).

Each name will make only one variable deletion, and this will be the variable found following the scope order: 'script' ->'sprite' ->'global'.

If we have a "testing" sprite variable and also a "testing" global one, deleting "testing" will delete only the sprite one (Yes! we can also do "delete var (testing, testing)" to delete both.

If one variable does not exists (in any scope) an error happens, stopping block action in that point. You can check it before with the "does var (name) exists?"block. </comment><header></header><code></code><translations>pt:remove as variáveis _
ca:esborra les variables _
es:borrar variables _
de:löschen var _
</translations><inputs><inputtype="%mult%txt"></input></inputs><script><blocks="doForEach"><l>each item</l><blockvar="names"/><script><blocks="doRun"><blocks="reportJSFunction"><list><l>varName</l><l>proc</l></list><l>if ((typeof varName) != "string" || varName === "") {
 throw new Error("name isn't a string: " + varName);
}
if (typeof proc.homeContext.var