Hello guys, For the following lines, I wanted to print numbers in ordered, but couldn't. Could you please help me and explain the reason Thanks in advance
``` numbers := []int{1, 2, 3, 4, 5} // Create a buffered channel to handle multiple values printed := make(chan int, len(numbers)) for _, n := range numbers { fmt.Println("Sending", n, "to the channel") go func() { printed <- n }() // Pass the value of n by copying it } // Receive all values from the channel in a loop for i := 0; i < len(numbers); i++ { fmt.Println(<-printed) } ``` -- Tanryberdi Shyhmyradov -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAK-WaRiONRf5p3XaxExXh7m6fh4ZXE6U9HuRr%3DxiP9Z2NZeMAQ%40mail.gmail.com.