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]
  3. import std.traits;
  4. enum bool isInputRange(R, E);

Examples

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

Meta