累加計算:
<xml>
<block type="variables_set" inline="false" x="-862" y="-755">
<title name="VAR">x</title>
<value name="VALUE">
<block type="text_prompt">
<title name="TYPE">NUMBER</title>
<title name="TEXT">請輸入從1加到什麼數?_</title>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">y</title>
<value name="VALUE">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">i</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
<statement name="DO">
<block type="variables_set" inline="false">
<title name="VAR">y</title>
<value name="VALUE">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="variables_get">
<title name="VAR">y</title>
</block>
</value>
<value name="B">
<block type="variables_get">
<title name="VAR">i</title>
</block>
</value>
</block>
</value>
</block>
</statement>
<next>
<block type="text_print" inline="false">
<value name="TEXT">
<block type="variables_get">
<title name="VAR">y</title>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
沒有留言:
張貼留言