Skip to content

Parameter passing

Parameters in NPL are passed by value for all types, except for protocols.

Trailing commas

NPL supports trailing commas wherever parameters can be specified.

function trailingCommas(
    a: Number,
    b: Number,
    c: Number,
) returns List<Number> -> {
    return listOf(
        a,
        b,
        c,
    );
};

protocol[p] Trailing(
    var a: Text,
    var b: Text,
) {
    permission[p] commas(
        c: Text,
        d: Text,
    ) { };
};