website stat

Swapping variables in Ruby

CODE:
  1. x, y = y, x

So simple and so beautiful.


2 Responses to “Swapping variables in Ruby”

  1. kordump
    Published at December 28th, 2007 at 8:15 pm

    é como diz na home do wordpress: “code is poetry”

  2. Alcides
    Published at December 28th, 2007 at 8:54 pm

    Same in Python and other dynamic languages I guess…

    And it’s one thing that should be in all of them, it’s so simple and easy to implement.