back

Implements the range interface primitive back for built-in arrays. Due to the fact that nonmember functions can be called with the first argument using the dot notation, array.back is equivalent to back(array). For narrow strings, back automatically returns the last code point as _a dchar.

  1. inout(T) back [@property getter]
    @property ref @safe pure nothrow @nogc
    inout(T)
    back
    (
    T
    )
    (
    return scope inout(T)[] a
    )
    if (
    !is(T[] == void[])
    )
  2. dchar back [@property getter]

Examples

int[] a = [ 1, 2, 3 ];
assert(a.back == 3);
a.back += 4;
assert(a.back == 7);

Meta

Suggestion Box / Bug Report