Tokens

Ali Çehreli acehreli at yahoo.com
Mon May 12 15:39:04 UTC 2025


On 5/12/25 12:10 AM, Justin Allen Parrott wrote:
> I don’t like [$-1], I want to define a token L to be $-1 and use o[L]

I like o.back:

import std.range;

void main() {
     int[] o = [ 1, 2, 3 ];
     assert(o[$-1] == o.back);
     assert(&(o[$-1]) == &(o.back));
}

Ali



More information about the Digitalmars-d-learn mailing list