Update samples/other/zerobasedlist.ring - support len() function.
@@ -2,12 +2,15 @@ oList = new ZeroBasedList( [1,2,3] )
? oList[0]
? oList[1]
? oList[2]
-
+? "Items Count: " + len(oList)
class ZeroBasedList
aItems = []
func init aList
aItems = aList
func operator cOperator,cValue
- if cOperator = "[]"
- return aItems[cValue+1]
- ok
+ switch cOperator
+ on "[]"
+ return &aItems[cValue+1]
+ on "len"
+ return len(aItems)
+ off
