ExpandCollapsePrev Next Index

+ 15.1 Records

There is another aggregate similar to a tuple except the fields are named:

    val x = (a=1, b=2.9, c="Hello");
    val y = x;
    println$ x.a + y.a;
    println$ x.b + y.b;
    println$ x.c + y.c;

The type of these records are given by:

    (a:int, b:double, c:string)

Records can have a any number of components, including 1 and 0. The record type with zero components is identified with the tuple with no components, namely unit.