编写函数,返回其(两个)参数正确的(自然)数字顺序
package main
import "fmt"
func main() {
a := 111
b := 22
m,n := order(a, b)
fmt.Printf("The first one is %d and the second one is %d", m, n)
}
func order(a, b int) (int, int) {
if a>b {
return b,a
}
return a,b
}
打印结果:
The first one is 22 and the second one is 111