From Test-Scratch-Wiki
新增项目 () () | |
新增項目 () \( [ v] \) | |
类别 | 清单类积木 |
形狀 | 条形积木 |
加入於 | 1.3 |
The Add () to () 积木 is a 清单类积木 and a 条形积木. The block adds an item onto the end of the specified 清单, the item containing the given text.
用法示例
In many 专案, lists continuously record 变量s; the record consists of the variable's current value continuously being added to the list. For the list to add more to its record, items need to be added; this block can do the job.
Some common uses for the Add () to () block:
- Adding information to a record-keeping list
當收到訊息 [game end v] 新增項目 (score) \( [previous scores v] \)
- Adding a message to a display
詢問 [What would you like to post?] 並等待 新增項目 (詢問的答案) \( [dialog v] \)
- Submitting objects into a list
當 @greenflag 被點擊 重複無限次 如果 <<[空白 v] 鍵被按下?> 且 <碰到 [apple v] ?>> 那麼 如果 <<清單 [fruits v] 包含 [apple] ?> 不成立> 那麼 新增項目 [apple] \( [fruits v] \) end 等待直到 <<[空白 v] 鍵被按下?> 不成立> end end
应用
- Main article: List of Block Workarounds
This block can be replicated with the following code:
添加 [item] 為第 (last v) 項\( [list v] \)
参见
— the version for 字串
Zho:变数类积木 | |
Zho:清单类积木 |
()
• 新增项目 () () • 删除第 () 项 () • 添加 () 为第 () 项 • 替换第 () 项于 () 成 () • 清单第 () 项项目 () • 清单 () 的项目数 • 清单 () 包含 () • 清单 () 显示 • 清单 () 隐藏更多积木… |