From Test-Scratch-Wiki
() | |
(我是變數) | |
类别 | 变量类积木 |
形狀 | 椭圆形积木 |
The () 积木 is a 变量类积木 and a 椭圆形积木. The block simply holds its 变量.
Whenever a variable is created, a version of the block appears with the variable's given name on it — this results in a version of this block for every variable. Each version of the block holds its 'assigned' variable.
This block can be displayed as a 舞台监控视窗.
应用
- Main article: List of Block Workarounds
A 全域变量 can be accessed with
([global variable v] \( [舞台 v] \))
A 局域变量 can be accessed with
([private variable v] \( [角色 v] \))
用法示例
Variables could never be used if there were no blocks that held them — this is the block that holds all variables. Additionally, variables' 舞台 monitors can be used as a display for text — it is easier to use than to create 角色s and program them to be a display.
The block can be used to:
- Save information
詢問 [What's your name?] 並等待 變數 [name v] 設為 (詢問的答案)
- Recall information
說出 (字串組合 [Hi, ] 和 (字串組合 (name) 和 [!]))
- Display information
重複無限次 說出 (random speech) end
No specific uses can be given for the () block, as it merely holds a variable. The only proper use is when the block has not been taken onto the scripting area, when you click on the little box to show the variable or hide it again. But this use has no scripting use, as there is already a 变数 () 隐藏积木 for scripting, so this use is probably only for testing games, interactive projects etc.
参见
Zho:变数类积木 | |
Zho:清单类积木 |
()
• 新增项目 () () • 删除第 () 项 () • 添加 () 为第 () 项 • 替换第 () 项于 () 成 () • 清单第 () 项项目 () • 清单 () 的项目数 • 清单 () 包含 () • 清单 () 显示 • 清单 () 隐藏更多积木… |