input: Write a python function to optimize a loop that sorts an array of numbers.
  assert optimizeLoop([64, 34, 25, 12, 22, 11, 90])==[11, 12, 22, 25, 34, 64, 90]
  assert optimizeLoop([5, 3, 8, 4, 2])==[2, 3, 4, 5, 8]
  assert optimizeLoop([1, 2, 3, 4, 5])==[1, 2, 3, 4, 5]
  assert optimizeLoop([5, 4, 3, 2, 1])==[1, 2, 3, 4, 5]
output: def optimizeLoop(arr):
      n = len(arr)
      for i in range(n):
          swapped = False
          for j in range(0, n-i-1):
              if arr[j] > arr[j+1]:
                  arr[j], arr[j+1] = arr[j+1], arr[j]
                  swapped = True
          if not swapped:
              break
      return arr