LoginLogin
Might make SBS readonly: thread

LAST

Root / Documentation / [.]

Created:
Get the index of the last element in an array or string. * Syntax ```sbsyntax lastIndex% = LAST(array[]) lastIndex% = LAST(string$) LAST array[] OUT lastIndex% LAST string$ OUT lastIndex% ``` |* Input | Description | | `array[]` | The array whose last index to get. | | `string$`| The string whose last index to get. | |* Output | Description | | `lastIndex%` | The last index of the array or string. | `lastIndex%` is the index of the last character in `string$` or the last element of `array[]`. All arrays are treated as linear; `LAST(v)` is always equivalent to `LEN(v)-1`. * Examples ```sb4 'get the last index of this string PRINT LAST("HELLO") '4 ``` ```sb4 'get the last index of an array DIM ARY[10] PRINT LAST(ARY) '10 ``` ```sb4 'all arrays are treated linearly DIM ARY[5,2] PRINT LAST(ARY) '5*2-1 = 9 ```

No posts yet (will you be the first?)