[Jprogramming] index origin 0

Zsbán Ambrus ambrus at math.bme.hu
Wed Jul 28 15:25:13 HKT 2010


2010年7月28日 Roger Hui <rhui000 at shaw.ca>:
> Negative indexing and index origin 1 can co-exist.  e.g.
>>   3 1 4 2 X 'abcd'
> cadb
>   _1 _2 _3 _4 X 'abcd'
> dcba

Indeed. Older versions of perl have a feature where you can change
the index origin (for arrays and strings) to one -- this has been
depreciated in newer versions for a while now. Perl also has negative
indexing. And, indeed, this is how perl interprets negative indices
when index origin is one.
Ambrus


More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /