does any language have a swap operator? like `<...
# announcements
h
does any language have a swap operator? like
<->
or something? would be cool if kotlin had one. NVM just gonna use
also
k
Do you want to swap variables?
Python has something like it:
x, y = y, x
h
yeah, python has that, but kotlin does not support multiple declarations in a single line
without semicolons, but kotlin has
x = y.also { y = x }
i just figure
x <-> y
is just as readable, and quicker, but i can understand why you wouldn't want to use type parameter brackets like that
k
Yeah
also
is the standard solution for this I think.
h
there are quite a few features in other languages i wish we had in kotlin
mind letting me know your thoughts on each if i list them?
k
Sure, thoughts are free simple smile