Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • D
int[42] items;
int x = items[$-1];

The dollar operator represents the length of the array that's referred to inside the square brackets.
import std.range;
int[] items;
auto x = items.back();

using the range semantic.
X := Items'Last

X must be declared earlier.

New implementation...