This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
- Ada
- C
- C
- Clojure
- Cobol
- C++
- C#
- C#
- D
- D
- Dart
- Elixir
- Erlang
- Fortran
- Fortran
- Go
- Groovy
- Haskell
- JS
- JS
- Java
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- PHP
- PHP
- Pascal
- Perl
- Python
- Python
- Ruby
- Rust
- Rust
- Scala
- Scheme
- Smalltalk
- VB
swap(a, b);
This is the most proper way. There are plenty of other ways, but this one should be the most correct, generic and performant.
fun1(A, B) ->
do:something(),
fun2(B, A).
fun2(A, B) ->
now(A, is, B),
and(B, is, A),
keep:moving().
Single assignment precludes you from swapping values in Erlang within the body of a single function.
If you really want the names to change (which you usually don't)… well… you have to move to a different function
If you really want the names to change (which you usually don't)… well… you have to move to a different function