# Arrays¶

In Felix, arrays are first class values.

## Type¶

An array is given a type consisting of the base type and length.

int^4


is a the type of an array of 4 ints. Note, the 4 there is not an integer but a unitsum type.

## Value¶

An array is given by a list of comma separated expressions:

var a :int^4 = 1,2,3,4;


## Operations¶

### Projection¶

The most fundamental operation is the application of a projection to extract the n’th component of an array. Components are numbered from 0 up.

var a :int^4 = 1,2,3,4;
for i in 0..<4 do


### Value Iteration¶

A for loop may take an array argument. The control variable takes on all the values in the array starting with the first.

var x = 1,2,3,4;
var sum = 0;
for v in x do
sum = sum + v;
done
println\$ sum;