LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

FIRST() function (SB4)

Root / Submissions / [.]

12Me21Created:
SB4 adds the convenient LAST(ARY) function, which returns the last index in the array/string (LEN(ARY)-1):
FOR I=0 TO LEN(ARY)-1 'old
FOR I=0 TO LAST(ARY) 'new
However, they have neglected to include a FIRST function, to find the first index in the array. I'm sure FIRST will be added soon in an update, but until then, here is a user defined function you can use:
DEF FIRST(ARY)
 RETURN LAST(ARY)-LEN(ARY)+1
END
Example usage:
FOR I=FIRST(ARY) TO LAST(ARY)
 PRINT ARY[I]
NEXT

OMG FINALLY I'm glad somebody made this :)

This hurts my bones. +1