const MaxCtr = 40 dim DataArr ( MaxCtr ) as string*30, ForwardDir as integer dim RetStr30 as string*30, Ctr as long declare function AddToSort as integer declare function GetTheNext as string declare function GetThePrev as string DataArr ( 1 ) = "Jim" DataArr ( 2 ) = "Scott" DataArr ( 3 ) = "Rick" DataArr ( 4 ) = "Greg" SortStart ForwardDir = InputYesNo ( "Return in ascending order " ) if AddToSort > 0 then do if ForwardDir then RetStr30 = GetTheNext else RetStr30 = GetThePrev end if if RetStr30 > "" then ? RetStr30 end if loop until RetStr30 = "" WaitEnter end if function AddToSort as integer dim SortItems as integer SortItems = 0 for Ctr = 1 to MaxCtr if trim ( DataArr ( Ctr ) ) > "" then sortItems = SortItems + 1 SortAdd ( DataArr ( Ctr ), Ctr ) end if next Ctr AddToSort = SortItems end function function GetTheNext as string dim tSortRet as long : tSortRet = SortNext if tSortRet > 0 then GetTheNext = DataArr ( tSortRet ) else GetTheNext = "" end if end function function GetThePrev as string dim tSortRet as long : tSortRet = SortPrev if tSortRet > 0 then GetThePrev = DataArr ( tSortRet ) else GetThePrev = "" end if end function