Easier adding to end or before beginning of an array

1 view
Skip to first unread message

John Bridges

Apr 24, 2012, 6:52:27 PM4/24/12
to after...@googlegroups.com
New build of AfterGRASP is up for download:
Tue, 24 April 2012

Arrays now support a add new item to beginning or end of array using
[-] for before beginning
[+] for after end

  test = array()
  test[+] = a
  test[+] = b
  test[+] = c
  test[+] = d
  test[-] = z
  test[-] = y

Same as:

  test[0] = a
  test[1] = b
  test[2] = c
  test[3] = d
  test[-1] = z
  test[-2] = y

This is very useful for adding items to a array. Previously the standard
method was to use the array size like this:

  test = array()
  test[test->size] = a
  test[test->size] = b
  test[test->size] = c
  test[test->size] = d

Much simpler and more robust to use [+] instead.


Reply all
Reply to author
0 new messages