' Sort Data with Bubble Sort
arrSample = Array(4, 6, 2, 7, 3, 5, 1)
WScript.Echo vbCrLf & "array before"
For Each intNumber In arrSample
WScript.Echo intNumber
Next
For i = LBound(arrSample) to UBound(arrSample)
For j = LBound(arrSample) to UBound(arrSample)
If j <> UBound(arrSample) Then
If arrSample(j) > arrSample(j + 1) Then
TempValue = arrSample(j + 1)
arrSample(j + 1) = arrSample(j)
arrSample(j) = TempValue
End If
End If
Next
Next
WScript.Echo vbCrLf & "array after"
For Each intNumber In arrSample
WScript.Echo intNumber
Next