Swapping two variables

Feature requests for future versions of Hollywood can be voiced here
Post Reply
pecaN
Posts: 124
Joined: Thu Jun 10, 2010 4:15 pm

Swapping two variables

Post by pecaN »

Hi,maybe it's a bit stupid one,but what about including a command for swapping two variables to Hollywood? Amos had the Swap(x,y) which did it well while in Hollywood for swapping x and y you have to use another variable eg. :
x = help
x = y
y = help

Sometimes the swap command would be very useful,I found it out while programming BoingPairs...
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Swapping two variables

Post by airsoftsoftwair »

Oh, well, here it is:

Function Swap(a, b) Return(b, a) EndFunction

Happy new year :)
Bugala
Posts: 1180
Joined: Sun Feb 14, 2010 7:11 pm

Re: Swapping two variables

Post by Bugala »

Ha, never thought it could be that easy.
Post Reply