(Redirected from Length of () (List))

Length of ()
3.0 Length of ().png
Category List
Type Reporter
Introduced in 1.3

The Length of () block is a List block and a Reporter block. The block reports how many items a list contains.

Example Uses

In certain projects, 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
say (join [You have ] (join (length of [list v]) [ items.]))
  • Iterating through a list by repeating the length amount of times.
repeat (length of [list v])
change [i v] by (1)
say (item (i) of [list v]) for (2) secs
end
  • Accessing the second last, for example, item of a list
(item ((length of [list v]) - (2)) of [list v])

See Also