Swap two variables (or more)

Find quick help here to get you started with Hollywood

Swap two variables (or more)

Postby lazi » Tue Oct 06, 2015 11:26 pm

It is a common task to swap the values of two variables.

The basic idea is to use a third temporary variable like this:


I have just learned that there is a better way with multiple assign:


Simple, and clever :)
You can ofcourse use more than two variables/values.
User avatar
Posts: 282
Joined: Fri Feb 25, 2011 12:08 am

Return to Newbie questions

Who is online

Users browsing this forum: No registered users and 1 guest