Working with list of string is pretty straightforward in Genie. I was wondering if one could locate the last added item with something similar to [-1] in python.
Taking the example from Genie's tutorial:
[indent=4]
init
/* test lists */
var l = new list of string
l.add ("Genie")
l.add ("Rocks")
l.add ("The")
l.add ("World")
for s in l
print s
print " "
print l[-1]
Aim
My expectative was that the l[-1] bit would point to "World" item. However it gives me the error at execution time:
ERROR:arraylist.c:954:gee_array_list_real_get: assertion failed: (index >= 0)
/tmp/geany_run_script_X6D4JY.sh: line 7: 13815 Abortado (imagem do núcleo gravada)/tmp/./test
Question
The gee array clearly only works with positive indexes, is there any other way to get the last added item on an array?