Search⌘ K
AI Features

Basic Array Functions

Explore the essential array functions in ReasonML such as accessing elements by index, modifying values, merging arrays, and calculating length. This lesson helps you develop a strong foundation in managing arrays as mutable data structures for practical programming.

Array Length

The length of an array can be calculated using the Array.length() utility.

Reason
let arr = Array.make(10, 0);
Js.log(Array.length(arr));

Accessing Elements

An array element can be accessed using its index. This is also known as indexing. We simply have to enclose the index in [] brackets and ...