Go Channel's doubts

an official demo

package main

import "fmt"

func sum(s []int, c chan int) {
    sum := 0
    for _, v := range s {
        sum += v
    }

    c <- sum // send sum to c
}

func main() {
    s := []int{7, 2, 8, -9, 4, 0}

    c := make(chan int)

    go sum(s[:len(s)/2], c) // 7,2,8 = 17

    go sum(s[len(s)/2:], c) // -9,4,0 = -5

    x, y := <-c, <-c // receive from c
    //
    fmt.Println(x, y, x+y) // 17,-5,12
}

normally, according to the FIFO result, it should be 17 br 5jue 12 < why the printed result is-5je 17je 12.
I don"t understand. Ask the boss to answer

Oct.03,2021

go sum () is executed asynchronously. You have two tasks. The order in which the two tasks are executed first and then is uncertain.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c32b-2c301.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c32b-2c301.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?