From Test-Scratch-Wiki

清单 () 的项目数
清單 [ v] 的項目數
类别 清单类积木
形狀 椭圆形积木
加入於 1.3

The Length of () 积木 is a 清单类积木 and a 椭圆形积木. The block reports how many 项目s a 清单 contains.


In certain 专案, different events can happen based on the length of a value; this block can be used here.

Some common uses for the Length of () block:

  • Checking the number of items a player has obtained
說出 (字串組合 [You have ] 和 (字串組合 (清單 [list v] 的項目數 :: list) 和 [ items.]))
  • Iterating through a list by repeating the length amount of times.
重複 (清單 [list v] 的項目數 :: list) 次 
  變數 [i v] 改變 (1)
  說出 (清單第 (i) 項項目\( [list v] \) :: list) (2) 秒
  • Accessing the second last, for example, item of a list
(清單第 ((length of [list v] :: list) - (2)) 項項目\( [list v] \) :: list)


Cookies help us deliver our services. By using our services, you agree to our use of cookies.