| 1. |
What's A Negative Index? |
|
Answer» Negative index is a mis-named feature of Python and some other languages. If the index is n, and n = -1, then this means, to python, in ENGLISH, "the last". In Euphoria, this WOULD be x[length(x)], or in a more CONVENIENT shorthand x[$]. In Python, -2 would MEAN "next to last". In Euphoria x[length(x)-1] or x[$-1]. Negative index is a mis-named feature of Python and some other languages. If the index is n, and n = -1, then this means, to python, in English, "the last". In Euphoria, this would be x[length(x)], or in a more convenient shorthand x[$]. In Python, -2 would mean "next to last". In Euphoria x[length(x)-1] or x[$-1]. |
|