---
title: "Sequences"
url: https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences
language: matlab
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Sequences

Programming language: MATLAB. Other languages: [C++](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/js.md), [PHP](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/php.md), [Python](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences/swift.md).

A sequence is an ordered list of zero or more elements of the same type.

## Sequence Syntax

A sequence definition consists of the `sequence` keyword, its element type, and a name:

```slice
module M
{
    enum Fruit { Apple, Pear, Orange }
    sequence<Fruit> FruitPlatter;
}
```

The element type can be any Slice type, including a sequence:

```slice
module M
{
    sequence<FruitPlatter> FruitBanquet;
}
```

## Language Mapping

The MATLAB mapping for a Slice sequence depends on the element type of the sequence:

| **Element Type (Slice)** | **Mapped Sequence Type (MATLAB)** |
| --- | --- |
| `bool`, numeric types, `enum`, `struct` | vector (1-by-n array) of the mapped element type |
| `string` | vector of `string` |
| All other types: `class`, proxies, `dictionary`, `sequence` | 1-by-n cell array of the mapped element type |

> **Warning**
>
> An empty sequence corresponds to a 1-by-0 array or cell array. It has the same type as a non-empty sequence.
