<pre>function bubbleSort data  repeat with x = 1 to the number of lines in data    repeat with y = x to the number of lines in data      if line x of data > line y of data then        get line y of data        put line x of data into line y of data        put it into line x of data      end if    end repeat  end repeat  return dataend bubbleSort</pre>