Zho:变数 () 设为 ()（积木）

The Set to  积木 is a 变量类积木 and a 条形积木. The block will set the specified 变量 to the given value: a 字串 or number. In Scratch 1.2.1 and earlier, only numbers could be entered.

Prior to Scratch 1.3, this block did not have a drop-down input listing the variables and instead there was an instance of it for each variable.



用法示例
When a 专案 is started, certain variables (such as score, the current level, etc.) must be reset for the project to work correctly.

Some common uses for the Set to  block:
 * Resetting a project

當 [0 v] 鍵被按下 計時器重置 播放音效 [SpaceRipple v] 變數 [x v] 設為 [0] 變數 [y v] 設為 [0]


 * Choosing a level number

當 [r v] 鍵被按下 變數 [level v] 設為 (隨機取數 (1) 到 (20))


 * Setting a value for a math formula

變數 [r v] 設為 (詢問的答案) 說出 ((((4) / (3)) * (pi)) * ((r) * ((r) * (r))))

应用
This block's actions can be replicated by the script segment below, where "amount" is the number you want to change it to.

變數 [variable v] 改變 ((amount) - (variable))

参见

 * 变数 改变
 * 舞台监控视窗
 * 变量