BlocosIA Wiki Editor

Arrays

Reporter

list with ( ) , ( ) , ( )

Creates a list with the items plugged in. Use + and − for more or fewer items. Items can be numbers, texts, other lists or objects.

Reporter

empty list

A list with no items. Use it in "set variable to" to start a list from scratch.

Reporter

list with ( ) repeated ( ) times

Creates a list with the same value repeated (e.g. 5 zeros).

Reporter

numbers from ( ) to ( ) step ( )

Creates the list of numbers from start to end, adding the step (e.g. 1, 3, 5, 7, 9).

Reporter

split text ( ) by ( )

Splits a text into pieces using the separator (e.g. "a,b,c" by ","). Numbers become numbers.

Reporter

table with ( ) rows and ( ) columns filled with ( )

Creates a table (list of lists) with rows and columns, great for boards and maps.

Reporter

item ( ) of ( )

Gets the item at a position (the first is 1). Negative numbers count from the end: -1 is the last.

Reporter

[primeiro] item of ( )

The first, the last or a random item of the list.

Reporter

length of list ( )

How many items the list has (in an object, how many keys).

Reporter

position of ( ) in ( )

At which position the value is in the list (0 = not there).

Boolean

( ) contains item ( ) ?

True if the list has that item (case does not matter).

Boolean

is list ( ) empty?

True if the list (or object) has no items.

Reporter

item row ( ) column ( ) of ( )

Reads a cell of a table (list of lists): row and column start at 1.

Boolean

( ) is [a list] ?

Asks whether a value is a list, an object, a number, a text or yes/no.

Reporter

type of ( )

Tells the value type: list, object, number, text or yes/no.

Stack

add ( ) to the end of list [score]

Puts an item at the end of the list stored in the variable (if it is not a list, it becomes one).

Stack

insert ( ) at position ( ) of list [score]

Puts an item at a position, pushing the others forward.

Stack

replace item ( ) of list [score] with ( )

Replaces the item at a position with another value.

Stack

delete item ( ) of list [score]

Removes the item at a position from the list.

Stack

remove ( ) from list [score] ([the first])

Removes the first item equal to the value (or all of them).

Stack

delete all items of list [score]

Makes the list empty.

Stack

sort list [score] in [ascending] order

Sorts the list stored in the variable itself: numbers ascending/descending or texts A to Z.

Reporter

join the items of ( ) with ( )

Joins all items into a text, with the separator between them (e.g. "apple, grape").

Reporter

list ( ) followed by ( )

A new list with the items of the first followed by those of the second.

Reporter

items ( ) to ( ) of ( )

A piece of the list, from position A to B.

Reporter

( ) in [ascending] order

A sorted copy of the list (the original does not change).

Reporter

list of objects ( ) in [ascending] order by key ( )

Sorts a list of objects by the value of a key (e.g. ranking by the key "points").

Reporter

[reverse] ( )

Reverses, shuffles, removes duplicates, flattens (lists inside lists become one) or copies the list.

Reporter

[sum] of the items of ( )

Sum, average, highest, lowest, product or median of the numbers in the list.

Reporter

how many times ( ) appears in ( )

How many times a value appears in the list.

Reporter

for each item of ( ) compute ( )

Creates a new list computing something for each item (use the "item" block). E.g. item × 2.

Reporter

items of ( ) where ⟨ ⟩

Keeps only the items where the condition is true (use the "item" block). E.g. item > 50.

Reporter

first item of ( ) where ⟨ ⟩

The first item where the condition is true (empty if none).

Boolean

[all items] of ( ) satisfy ⟨ ⟩ ?

True if all, some or no item meets the condition.

Reporter

accumulate ( ) starting with ( ) computing ( )

Reduces the list to one value: on each loop, "total" is the previous result and "item" the current item (e.g. total + item = sum).

Reporter

item

The current item inside "compute", "where" and "accumulate".

Reporter

item index

The position (1, 2, 3…) of the current item.

Reporter

total

The result accumulated so far, inside "accumulate".