package main import ( "fmt" ) var ( array = []int{3,6,1,8,5} ) func main() { for _,v := range sort(array) { fmt.Println(v) } } func sort(array []int) []int { for i := 0; i < len(array); i++ { for j := 0; j < len(array)-i-1; j++ { if array[j] < array[j+1] { array[j],array[j+1] = array[j+1],array[j] } } } return array }原文链接:https://www.f2er.com/go/191460.html