End-Of-Array operator
  [Thread Prev] | [Thread Next]
 
 
- Subject: End-Of-Array operator
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Fri, 6 Nov 2015 23:27:21 -0800
- To: myrddin-dev@xxxxxxxxxxxxxx
There is now a shorthand for '<thing-i-am-indexing>.len'
    var a = [1,2,3]
    std.put("last = {}\n", a[$-1])      /* equivalent to a[a.len - 1] */
    std.put("last two = {}\n", a[$-2:]) /* equivalent to a[a.len - 2:] */
The output from this code should be:
    last = 3
    last two = [2, 3]
-- 
    Ori Bernstein
- Prev by Date: Libdate merged.
- Next by Date: Some fixes for building on Linux and Clang
- Previous by thread: Libdate merged.
- Next by thread: Some fixes for building on Linux and Clang
- Index(es):