# length proc

Source: https://ref.dm-lang.org/proc/length

### Format
> `length(E)`

### Returns
> The length of the data associated with E.

### Args
> E: text, list, file, or vector

```dm /length/
world << length("Hi")
```

This outputs, "2", the length of the string "Hi".

```dm /length/
world << length(list(1,2,3))
```

This outputs, "3", the length of the list.

```dm /length/
world << length(file("test.txt"))
```

This outputs the length of the file.

> [!note]
> 
> In strings containing non-ASCII characters, this is the length in bytes, not characters; a character may span multiple bytes. Use `length_char()` to work with character counts instead of bytes. See the [Unicode](https://ref.dm-lang.org/notes/Unicode.md) section for more information.

For vectors, the length is the order of the vector, as in 2 for a 2D vector or 3 for a 3D vector. See [vector.len](https://ref.dm-lang.org/vector/var/len.md).

### See also
> [vector](https://ref.dm-lang.org/vector/index.md)
