运算积木:加减乘除
-
先修科目
介绍
积木加(+)、减(-)、乘(*)、除(/)是运算类别的报表积木。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/eaabca6a-516d-4d8d-b7e6-b41b079f2183.png" width="600" style="">
这4个积木分别使两个数进行加、减、乘、除运算。因为它们是报表积木,所以计算结果就报告为该积木的数值。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1851b7ca-6e60-4315-9e4e-1a8bd61b7998.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
用变量作为输入值
在这些积木中,你还可以用“变量”作为输入值。为变量赋值后,你就可以把变量放到运算积木的输入框:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/fec35c77-4db8-4ff0-a4e0-c5aa499c5187.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">
把结果存到一个变量
你可以把运算结果存到一个变量,然后在舞台窗口显示这个变量的值,如下所示:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/13460386-aeeb-4e1e-80f4-e727bc748ede.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">
嵌套运算积木
还可以把一个运算积木放入另一个运算积木的输入框中,就组成“嵌套运算”。请注意:嵌套运算积木的顺序很重要:例如,1+(3*2)与(1+3)*2会得出不同的结果。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3c6b33a1-20d0-4e54-b417-bc4a0b5464d3.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login