跳至主要內容
yomihon 書庫
整體狀況設定

鍵盤快捷鍵

⌘K / Ctrl K
搜尋
Esc
關閉搜尋或篩選
/
跳到導覽篩選(單鍵開啟時)
[
收合或展開側欄(單鍵開啟時)

關掉之後,/ 和 [ 都只會照瀏覽器原本的方式輸入;⌘K 與 Esc 不受影響。

設定
esc

↑↓ 選擇 ↵ 搜尋 esc 關閉

Lesson template

lesson檔案變更於
檔案變更於
類型
lesson
語言
en
在 Obsidian 開啟留下自己的想法
檔案變更於
類型
lesson
語言
en
在 Obsidian 開啟留下自己的想法

What this lesson covers

A buffered channel has finite capacity.

What to do

What does this program print?

package main

import "fmt"

func main() {
    ch := make(chan int, 1)
    ch <- 42
    fmt.Println(<-ch)
}
Result

42. The buffer holds the value until the receive removes it. A second send before that receive would block.

What it assumes

Functions and variables. See channel 的交接 for send and receive rules.

作者標記的狀態

不屬於生命週期治理範圍