# 075c743aee143294ac0d6f6594fe3dbbbe6eb60d06057118373e4e3ce29425f3 Elan 2.0.0-alpha4 valid

main
  variable li set to [7, 1, 0, 4, 8, 3, 6]
  call print(li)
  call inPlaceRippleSort(li)
  call print(li)
end main

procedure inPlaceRippleSort(li as List<of Int>)
  variable hasChanged set to true
  variable lastComp set to li.length() - 2
  while hasChanged is true
    set hasChanged to false
    for i in range(0, lastComp + 1)
      if li[i] > li[i + 1] then
        variable temp set to li[i]
        set li[i] to li[i + 1]
        set li[i + 1] to temp
        set hasChanged to true
      end if
    end for
    set lastComp to lastComp - 1
  end while
end procedure
