DEV Community

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

Collapse
 
theoutlander profile image
Nick Karnik

Your comments appear incorrect.

y = y-x is basically the difference between y and x and not -x.

You might want to try this solution in code for correctness.