Sorting an array of numbers should be easier than a string list, try the following to get started - a bit more work work be needed using Array.GetAllIndices if the array is not always a list indexed by integers from 1 to the number of elements in the array.

'Create array of random numbers to sort nvar = 20 For i = 1 To nvar var[i] = Math.GetRandomNumber(100) EndFor

'Sort the variables SortVar()

'Output the sorted list For i = 1 To nvar TextWindow.WriteLine(var[i]) EndFor

Sub SortVar 'bubble sort variables - must be in array called var For i = 1 To Array.GetItemCount(var)-1 For j = i+1 To Array.GetItemCount(var) If (var[j] < var[i]) Then temp = var[i] var[i] = var[j] var[j] = temp EndIf EndFor EndFor EndSub

Marked as answer byVijaye RajiFriday, January 8, 2010 4:41 PM