Mega Code Archive

 
Categories / Ruby / Language Basics
 

Swap the value of two variables

a, B = 1, 2     # Same as x = 1; y = 2 a, b = b, a     # Swap the value of two variables