m (strings -> string)
Line 1: Line 1:
|name = Length of ()
|name = Length of ()
|image = File:2.0 Length of ().png
|image = File:3.0 Length of ().png
|category = [[List Blocks|List]]
|category = [[List Blocks|List]]
|type = [[Reporter Block|Reporter]]
|type = [[Reporter Block|Reporter]]

Revision as of 03:30, 9 January 2019

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
  • Accessing the second last, for example, item of a list
(item ((length of [list v]) - (2)) of [list v])

See Also