Parallel Assignment in Ruby

Watch out! This tutorial is over 7 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

A parallel assignment sets several variables at once. All right sides are computed before any variable is assigned, so all right side values are computed with the old variable values. This is very convenient for swapping two values without using a temporary.

Continue reading