In order to access the last element of a list or the last character of a string, you have to perform three commands:
- Get the length of the container.
- Subtract one from it to point to the last element of the container.
- Access the container.
The code for that looks like this:
IN index GET LENGTH OF container
DECREMENT index
IN value STORE container:index
Goes without saying that this syntax is very cumbersome, as accessing the last value of a container is something that's commonly done.
I propose a new statement:
IN index GET LAST INDEX OF container
This statement would store in index the ordinal value of the last valid index of the container.
In order to access the last element of a list or the last character of a string, you have to perform three commands:
The code for that looks like this:
Goes without saying that this syntax is very cumbersome, as accessing the last value of a container is something that's commonly done.
I propose a new statement:
This statement would store in
indexthe ordinal value of the last valid index of thecontainer.