The issue seems to be how the .Find( ) function works.
That is using Integer or Floating Points and using .Find( ) on an Unsorted Array., it will fail (-1 or "Could not Find").
Where-as if you use .Sort( ) first then it will work.
This will also work IF you manually sort:
Global Names1 As Integer[] : Names1 = [ 35, 3, 4, 23, 12, 16, 24, 19, 93 ]
Global Names2 As Integer[] : Names2 = Names1
CustomSort( Names1 )
//Names.Sort()
Global NameString1 As String = ""
Global NAmeString2 As String = ""
Repeat
NameString1 = ""
NameString2 = ""
For Element = 0 To Names1.Length
NameString1 = NameString1 + Str( Names1[ Element ] ) + ", "
NameString2 = NameString2 + Str( Names2[ Element ] ) + ", "
Next
Print( NameString1 )
Print( NameString2 )
Print( "19 is at Index: " + Str( Names1.Find( 19 ) ) )
Print( "19 using CustomFind is at Index: " + Str( CustomFind( Names2, 19 ) ) )
Sync( )
Until GetRawKeyPressed( 27 )
End
Function CustomSort( Array Ref As Integer[] )
Local SizeOf As Integer : SizeOf = Array.Length
Local Sorted As Integer
Local IsSorted As Integer
Local Element As Integer
Repeat
If Array[ Element ] > Array[ Element + 1 ]
Array.Swap( Element, Element + 1 )
EndIf
Inc Element
If Element = SizeOf Then Element = 0
For Index = 1 To SizeOf
If Array[ Index ] < Array[ Index - 1 ]
Exit
EndIf
If Index = SizeOf Then IsSorted = True
Next
Until IsSorted = True
EndFunction
Function CustomFind( Array As Integer[], Value As Integer )
For Element = 0 To Array.Length - 1
If Array[Element] = Value
ExitFunction Element
EndIf
Next
EndFunction -1
This said as "Find" ONLY works on the Root Type Element., it tends to be a better solution to use a Custom Find for what you want to look for.
The main downside is that without templates... we can't do this as a Single Function for Any Array; but instead must have a custom find for each array type we expect.