In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: Without using Temp Sort: Do Flip = 0 For Index = 0 to 7 [b]Index_Plus_1 = Index + 1[/b] If Sensor(Index) < Sensor(Index_Plus_1) Then Flip = 1 Sensor(Index) = Sensor(Index) ^ Sensor(Index_Plus_1) Sensor(Index_Plus_1) = Sensor(Index_Plus_1) ^ Sensor(Index) Sensor(Index) = Sensor(Index) ^ Sensor(Index_Plus_1) Endif Next Loop Until Flip = 0 RETURN The ^ operator is the XOR operator regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=174704#m174718 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)