bloct
2
Block 3 can be written like so, unless there's something different going on with the "value of variable" block.
Blocks 1 and 2 could possibly be implemented using that Javascript function reporter but I don't know any Javascript.
this is actually something I want to do, and that last block has already been made, I can't remember who made it, but here it is.
and here's the xml
<blocks app="Snap! 5.4, http://snap.berkeley.edu" version="1"><block-definition s="variable %'var'" type="reporter" category="variables"><header></header><code></code><translations></translations><inputs><input type="%s"><options>§_getVarNamesDict</options></input></inputs><script><block s="doIf"><custom-block s="does variable %s exist?"><block var="var"/></custom-block><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>v</l></list><l>return this.variables.getVar(v)</l></block><list><block var="var"/></list></block></block></script></block><block s="doRun"><block s="reportJSFunction"><list><l>v</l></list><l>throw new ReferenceError(`Variable ${v} does not exist.`)</l></block><list><block var="var"/></list></block></script></block-definition></blocks>
the <does variable exist?> block is in the create variables in program library
I tried this, but it only worked, when you put a variable in a ring, not with a block that reports a ringed variable.
Thanks! This is very useful!
Do you have a variable and a variable reporter both named variable
?