Skip to content

Commit

Permalink
fix: indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
novalagung committed Oct 15, 2023
1 parent 49b153f commit 51e41f3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions content/A-buffered-channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ Berikut adalah contoh penerapan buffered channel. Program di bawah ini merupakan
package main

import (
"fmt"
"runtime"
"time"
"fmt"
"runtime"
"time"
)

func main() {
runtime.GOMAXPROCS(2)
runtime.GOMAXPROCS(2)

messages := make(chan int, 2)
messages := make(chan int, 2)

go func() {
for {
i := <-messages
fmt.Println("receive data", i)
}
}()
go func() {
for {
i := <-messages
fmt.Println("receive data", i)
}
}()

for i := 0; i < 5; i++ {
fmt.Println("send data", i)
messages <- i
}
for i := 0; i < 5; i++ {
fmt.Println("send data", i)
messages <- i
}

time.Sleep(1 * time.Second)
time.Sleep(1 * time.Second)
}

```
Expand Down

0 comments on commit 51e41f3

Please sign in to comment.