Compare commits
3
Commits
9b5169b78b
..
lc3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15539ea817 | ||
|
|
bf75705fd6 | ||
|
|
1f8e8e006e |
@@ -5,6 +5,22 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func add(x int, y int) int {
|
||||||
|
return x + y
|
||||||
|
}
|
||||||
|
|
||||||
|
func add2(x, y int) int {
|
||||||
|
return x + y
|
||||||
|
}
|
||||||
|
|
||||||
|
func swap(x, y string) (string, string) {
|
||||||
|
return y, x
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("You know Pi =", math.Pi)
|
fmt.Println("You know Pi =", math.Pi)
|
||||||
|
fmt.Println("And You know 1+2 =", add(1, 2))
|
||||||
|
fmt.Println("And You know 1+2 =", add2(1, 2), "Using syntax sugar")
|
||||||
|
a, b := swap("hello", "world")
|
||||||
|
fmt.Println("And You know swap('hello', 'world') =", a, b)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user