Check out this example. It contains a Swap variable so that it can abort the loop as soon as the list is sorted. Much faster for lists that are already fairly well sorted:
For i = TotalFruit-1 To 0 Step - 1
Local swap = 0
For j=1 To i
If FruitArray(j)\y > FruitArray(j-1)\y
swap = 1
Local tempf.fruit = FruitArray(j)
FruitArray(j) = FruitArray(j-1)
FruitArray(j-1) = tempf
EndIf
Next
If swap = 0 Then Exit
Next