funcmain(){ i:=0 for{ i++; ifi>10{ break; } fmt.Println(i) } fmt.Println("-----------") arr:=[5]int{1,2,3,4,5} fori,j:=0,len(arr)-1;i<j;i,j=i+1,j-1{ arr[i],arr[j]=arr[j],arr[i] } for_,res:=rangearr{ fmt.Println(res) } }
funcmain(){ i:=0 for{ i++; ifi>10{ break; } fmt.Println(i) } fmt.Println("-----------") arr:=[5]int{1,2,3,4,5} fori,j:=0,len(arr)-1;i<j;i,j=i+1,j-1{ arr[i],arr[j]=arr[j],arr[i] } for_,res:=rangearr{ fmt.Println(res) } }