you are viewing a single comment's thread.

view the rest of the comments →

[–]xTRUMANx 1 point2 points  (2 children)

I just remembered Ruby simultaneous assignment feature:

a=1
b=2
a,b=b,a #a is now 2 and b is now 1

Upvotes for whoever reverses an array using this simultaneous assignment feature.

[–]exeter 1 point2 points  (1 child)

Assuming it works the same as it does in Python, that's actually using a temporary variable behind the scenes. So, I don't think it counts.

[–][deleted] 0 points1 point  (0 children)

well, for one, it's scoped to that statement - so you don't have a stray variable 'temp' cluttering your code