How to SWAP in Mojo #312
-
Unlike Python, we can't swap the values of variables in a single statement. |
Beta Was this translation helpful? Give feedback.
Answered by
lattner
Jun 4, 2023
Replies: 1 comment
-
Thanks for the nudge, I implemented support for tuples on the left side. They still require parens, but this allows
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lattner
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the nudge, I implemented support for tuples on the left side. They still require parens, but this allows
(a, b) = (b, a)
to work in the next update. In the meantime you can use a temporary like: