Swap

Swap sub (exchanging two values) by the model it exists in QBasic

code format="thinbasic" 'example x = 1 : y = 2 print x, y         'Naturally prints 1 2 call swap x, y   print x, y          'Prints 2 1

' sub swap byRef x, byRef y   tmp = x    x = y    y = tmp end sub code

WARNING. This thing would not work for array items - so you cannot use it to bubble sort array. Sorry it is plain written in the Help - you cannot use byRef with array items (that is, you can, but it would't work).