DEV Community

Discussion on: How can you swap two variables without using a third?

Collapse
 
phucduong86 profile image
Phuc Duong

Ah, I thought it wouldn't work but at midnight computer tells you lies :).

The multiple assignment in Go ( assuming C/C++ are the same mechanism, and i see Python below) works though.

x, y = y,x