arrayTruncateLast function

Array arrayTruncateLast(
  1. Array a
)

Return an Array without the last element

Examples

var n = Array([1, 2, 3]);

print(arrayTruncateLast(n));

/* output:
Array([1.0, 2.0])
*/

Implementation

Array arrayTruncateLast(Array a) {
  var c = Array.fixed(a.length - 1);
  for (var i = 0; i < c.length; i++) {
    c[i] = a[i];
  }
  return c;
}