Skip to end of metadata
Go to start of metadata


Lists are mutable sequences of items. They are similar to lists in Python.

Lists are surrounded by brackets, just like python: [1,2,3]

Here is some sample code demonstrating different operations you can do on lists:


Arrays are similar to arrays in C, C#, or Java. They are initialized to a certain fixed length, and all the items in an array are generally of the same type (int, string, etc.).

In boo, arrays use parentheses to surround the items instead of brackets: (1,2,3).

If you need to declare the type of an array, use parentheses surrounding the type of item in the array, such as (int) for an array of ints or (object) for an array of objects.

Boo's arrays and lists are zero-based, so the first item is item 0, the 2nd is item 1, etc.

Byte arrays and Char Arrays

Creating byte arrays - arrays of type (byte).

Boo right now doesn't support implicitly converting int literals to type byte, so you need to use the array() builtin function.

Char arrays - arrays of type (char).

Boo also right now doesn't have support for implicitly converting single character string literals (like "a") to the char type. A workaround it to use slicing ("a"0), but in this case you can use the ToCharArray method of the string class instead:

Creating an empty, zero-length array

Sometimes a system function might require passing an array even if it is empty. Here are some ways to create an empty zero-length array of type (object):

Slicing Lists and Arrays

You can also "slice" lists and arrays to get a particular subset of a list or array.

See Slicing.

Multidimensional Arrays

Recently boo added support for Multidimensional Arrays, also called rectangular arrays.

  • No labels