Programming
Python
R
Java
C
C++
C#
WEB
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
MORE
Examples1
Python
GO
R
Java
C
C++
C#
Examples2
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Seo Tools
Code Minifier
Code Beautifier
Language Compiler
Misc Tools
File Converter
References
C
C++
Python
Java
PHP
JavaScript
Examples
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Home
About
Contact
JetPack
Multi Themes-->>
Code it ALL
Scroll TOP
Swap Two Variables in go - CodeGK
Δ Go Examples
Examples
Hello world in go
Add Two Numbers in go
Find the Square Root in go
Swap Two Variables in go
Generate a Random Number in go
Find ASCII Value of Character in go
♦ Swap Two Variables in go
♣ Example1: Swap Two Variables in go
Input:
Run CODE
Reload Code
Copy Code
package main import ( "fmt" ) func swapTwo(num1, num2 int) (int, int) { return num2, num1 } func main() { var num1, num2 int = 9, 14 fmt.Println(num1, num2) num1, num2 = swapTwo(num1, num2) fmt.Println(num1, num2) }
Output: