turtlestitch/libraries/cases.xml

1 wiersz
3.5 KiB
XML

<blocks app="Snap! 6, https://snap.berkeley.edu" version="1"><block-definition s="cases: if %&apos;test&apos; then %&apos;result&apos; %&apos;more&apos;" type="command" category="control"><comment w="262" collapsed="false">Multi-branched conditional.&#xD;&#xD;If the first (Boolean) input is True, then the script in&#xD;the second (C-slot) input is run, and this block stops.&#xD;&#xD;Additional tests can be added by putting one or more&#xD;ELSE IF blocks in the third (variadic) Boolean slot.&#xD;Use the arrowheads to get the number of Boolean&#xD;slots you need. Each ELSE IF block provides a Boolean&#xD;slot for a condition to test and a script slot for what to do&#xD;if the condition is True. You can put an ELSE block in&#xD;the last Boolean input to CASES for a script to run if&#xD;all the tests turn out False.&#xD;&#xD;As soon as a condition is True, no further tests are done&#xD;and no further scripts are run.</comment><header></header><code></code><translations>pt:se _ , então _ _&#xD;</translations><inputs><input type="%b"></input><input type="%cs"></input><input type="%mult%boolUE"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doRun"><block var="result"/><list></list></block></script><script><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doForEach"><l>item</l><block var="more"/><script><block s="doIf"><block s="evaluate"><block var="item"/><list></list></block><script><custom-block s="throw %s"><block var="tag"/></custom-block></script></block></script></block></script></custom-block></script></block></script></block-definition><block-definition s="catch %&apos;tag&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations>pt:captura _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doRun"><block var="action"/><list></list></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %&apos;cont&apos;" type="command" category="control"><header></header><code></code><translations>pt:lança _&#xD;</translations><inputs><input type="%s">catchtag</input></inputs><script><block s="doRun"><block var="cont"/><list></list></block></script></block-definition><block-definition s="else if %&apos;test&apos; then %&apos;action&apos;" type="predicate" category="control"><comment w="176" collapsed="false">For use with the CASES block.&#xD;See its help message.</comment><header></header><code></code><translations>pt:senão, se _ , então _&#xD;</translations><inputs><input type="%b"></input><input type="%cs"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doRun"><block var="action"/><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block></script></block-definition><block-definition s="else %&apos;action&apos;" type="predicate" category="control"><comment w="176" collapsed="false">For use with the CASES block.&#xD;See its help message.</comment><header></header><code></code><translations>pt:senão, _&#xD;</translations><inputs><input type="%cs"></input></inputs><script><block s="doRun"><block var="action"/><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block-definition></blocks>