Skip to content

サンプルコードおよび実行結果と、説明文が一致していない #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
youkinjoh opened this issue Mar 31, 2025 · 0 comments

Comments

@youkinjoh
Copy link

3.3. 関数の「関数に複数の仮引数を持たせたいときは、仮引数定義をカンマで区切ってください。 こんな感じです」以降に掲載されているサンプルコードおよび実行結果は

fn print_labeled_measurement(value: i32, unit_label: char) {
    println!("The measurement is: {}{}", value, unit_label);
}

のように値と単位を渡す関数を使用しているが、
説明文は

この例では、2引数の関数を生成しています。そして、引数はどちらもi32型です。それからこの関数は、 仮引数の値を両方出力します。関数引数は、全てが同じ型である必要はありません。今回は、 偶然同じになっただけです。

xに対して値5、yに対して値6を渡して関数を呼び出したので、この二つの文字列は、 この値で出力されました。

のようになっている。

markdownの該当箇所は以下。
https://github.com/rust-lang-ja/book-ja/blob/master-ja/src/ch03-03-how-functions-work.md?plain=1#L160-L203

読み込んでいるサンプルコードと実行結果が誤っている?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant