For further actions, you may consider blocking this person and/or reporting abuse
Read next
Meningkatkan User Experiece (UX) Aplikasi Menggunakan useOptimistic Hooks pada React JS/Next JS
Yoga Meleniawan Pamungkas -
Sunday Fun: Re-creating a Radiohead cover
Mads Stoumann -
Introduction to Containerization on AWS ECS (Elastic Container Service) and Fargate
Salaudeen O. Abdulrasaq -
Menggunakan Zustand Sebagai State Management pada React/Next JS.
Yoga Meleniawan Pamungkas -
Top comments (4)
While it does have some educational value to show that this is possible, this method has two issues:
Both
a = a + b
anda = a - b
can cause an overflow.I can't imagine many situations where saving a few bytes really makes up for the loss in readability.
It also works with XOR (avoiding the overflow problem):
Agreed, this is definitely the way to do it.
reduced to one line:
a ^= b ^= a ^= b;