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]
  2. dchar back [@property getter]
    @property @safe pure
    dchar
    back
    (
    T
    )
    (
    scope const(T)[] a
    )
  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