From 2c4d848e2a3c66bdf35754b637b936e959bd38b2 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Wed, 15 Jun 2016 11:39:29 +0900 Subject: [PATCH 1/5] =?UTF-8?q?-=20v1.9=E3=81=AEif=E6=96=87=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AE=E7=BF=BB=E8=A8=B3=E3=82=92=E3=81=97?= =?UTF-8?q?=E3=81=9F=20-=20v1.9=E3=81=AE=E3=82=AA=E3=83=AA=E3=82=B8?= =?UTF-8?q?=E3=83=8A=E3=83=AB=E8=8B=B1=E6=96=87=E3=81=AB=E5=B7=AE=E3=81=97?= =?UTF-8?q?=E6=9B=BF=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.9/en/book/if.md | 2 +- 1.9/ja/book/if.md | 42 ++++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/1.9/en/book/if.md b/1.9/en/book/if.md index a532dabf..52d0dd88 100644 --- a/1.9/en/book/if.md +++ b/1.9/en/book/if.md @@ -4,7 +4,7 @@ Rust’s take on `if` is not particularly complex, but it’s much more like the `if` you’ll find in a dynamically typed language than in a more traditional systems language. So let’s talk about it, to make sure you grasp the nuances. -`if` is a specific form of a more general concept, the ‘branch’. The name comes +`if` is a specific form of a more general concept, the ‘branch’, whose name comes from a branch in a tree: a decision point, where depending on a choice, multiple paths can be taken. diff --git a/1.9/ja/book/if.md b/1.9/ja/book/if.md index 42fe6a66..81132c4e 100644 --- a/1.9/ja/book/if.md +++ b/1.9/ja/book/if.md @@ -4,24 +4,23 @@ -Rustにおける `if` の扱いはさほど複雑ではありませんが、伝統的なシステムプログラミング言語のそれに比べて、 -動的型付け言語でみられる `if` にずっと近いものになっています。そのニュアンスをしっかり理解できるよう、 -さっそく説明していきましょう。 +Rustにおける `if` の扱いは さほど複雑ではありませんが、伝統的なシステムプログラミング言語のそれと比べて、 +動的型付け言語の `if` により近いものになっています。そのニュアンスをしっかり理解できるように、説明しましょう。 - + -`if` は一般化されたコンセプト、「分岐(branch)」の特別な形式です。この名前は木の枝(branch)を由来とし: -取りうる複数のパスから、選択の決定を行うポイントを表します。 +`if` は より一般的なコンセプトの一つである、「分岐(branch)」の具体的な形です。この名称は、木の枝(branch)に由来します: +決定点はひとつの選択に依存し、複数のパスを取ることができます。 -`if` の場合は、続く2つのパスから1つを選択します。 +`if` の場合は、二つのパスを導く ひとつの選択があります。 ```rust let x = 5; if x == 5 { -# // println!("x is five!"); +// println!("x is five!"); println!("x は 5 です!"); } ``` @@ -29,45 +28,44 @@ if x == 5 { -仮に `x` を別の値へと変更すると、この行は表示されません。より正確に言うなら、 -`if` のあとにくる式が `true` に評価された場合に、ブロックが実行されます。 -`false` の場合、ブロックは実行されません。 +もし、`x` を別の値に変更すると、この行は出力されません。よりわかりやすく説明すると、 +`if` のあとにくる式が `true` に評価された場合、そのブロックが実行されます。また、`false` の場合は、それは実行されません。 -`false` の場合にも何かをしたいなら、 `else` を使います: +`false` の場合にも何かをしたい時は、 `else` を使います: ```rust let x = 5; if x == 5 { -# // println!("x is five!"); +// println!("x is five!"); println!("x は 5 です!"); } else { -# // println!("x is not five :("); +// println!("x is not five :("); println!("x は 5 ではありません :("); } ``` -場合分けが複数あるときは、 `else if` を使います: +複数の条件がある時は、 `else if` を使います: ```rust let x = 5; if x == 5 { -# // println!("x is five!"); +// println!("x is five!"); println!("x は 5 です!"); } else if x == 6 { -# // println!("x is six!"); +// println!("x is six!"); println!("x は 6 です!"); } else { -# // println!("x is not five or six :("); +// println!("x is not five or six :("); println!("x は 5 でも 6 でもありません :("); } ``` -全くもって普通ですね。しかし、次のような使い方もできるのです: +これは当然なことですが、次のように書くこともできます: ```rust let x = 5; @@ -80,7 +78,7 @@ let y = if x == 5 { ``` -次のように書くこともできます(そして、大抵はこう書くべきです): +また、次のように、書くのがほとんどの場合良いでしょう: ```rust let x = 5; @@ -91,6 +89,6 @@ let y = if x == 5 { 10 } else { 15 }; // y: i32 -これが出来るのは `if` が式であるためです。その式の値は、選択された分岐中の最後の式の値となります。 -`else` のない `if` では、その値は常に `()` となります。 +これが出来るのは `if` が式だからです。その式の値は、選択された条件の最後の式の値です。 +`else` のない `if` では、その値は常に `()` になります。 From 02c41e89abd374fadf88abef555c7d64f1ba4972 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Wed, 15 Jun 2016 18:53:26 +0900 Subject: [PATCH 2/5] =?UTF-8?q?1=E3=82=BB=E3=83=B3=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=81=A8=E3=80=81=E7=A9=BA?= =?UTF-8?q?=E8=A1=8C=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.9/ja/book/if.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/1.9/ja/book/if.md b/1.9/ja/book/if.md index 81132c4e..054efe9d 100644 --- a/1.9/ja/book/if.md +++ b/1.9/ja/book/if.md @@ -78,7 +78,7 @@ let y = if x == 5 { ``` -また、次のように、書くのがほとんどの場合良いでしょう: +また、次のように書くのがほとんどの場合良いでしょう: ```rust let x = 5; @@ -90,5 +90,4 @@ let y = if x == 5 { 10 } else { 15 }; // y: i32 これが出来るのは `if` が式だからです。その式の値は、選択された条件の最後の式の値です。 -`else` のない `if` では、その値は常に `()` になります。 - +`else` のない `if` では、その値は常に `()` になります。 \ No newline at end of file From 6a2bf4ad781b6b8d0dda532c261de34cde8c7a2e Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Thu, 16 Jun 2016 10:46:40 +0900 Subject: [PATCH 3/5] =?UTF-8?q?If.md=20=E3=81=AEdiff=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diff-1.6.0..1.9.0/src/doc/book/if.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 diff-1.6.0..1.9.0/src/doc/book/if.md diff --git a/diff-1.6.0..1.9.0/src/doc/book/if.md b/diff-1.6.0..1.9.0/src/doc/book/if.md deleted file mode 100644 index 9238f620..00000000 --- a/diff-1.6.0..1.9.0/src/doc/book/if.md +++ /dev/null @@ -1,12 +0,0 @@ ---- a/src/doc/book/if.md -+++ b/src/doc/book/if.md -@@ -4,7 +4,7 @@ Rust’s take on `if` is not particularly complex, but it’s much more like the - `if` you’ll find in a dynamically typed language than in a more traditional - systems language. So let’s talk about it, to make sure you grasp the nuances. - --`if` is a specific form of a more general concept, the ‘branch’. The name comes -+`if` is a specific form of a more general concept, the ‘branch’, whose name comes - from a branch in a tree: a decision point, where depending on a choice, - multiple paths can be taken. - -diff --git a/src/doc/book/inline-assembly.md b/src/doc/book/inline-assembly.md From f113c1e874872d1e460447228d1088e270025b2b Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Thu, 16 Jun 2016 23:28:36 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E8=A1=8C?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.9/ja/book/if.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/1.9/ja/book/if.md b/1.9/ja/book/if.md index 054efe9d..bcc8cd44 100644 --- a/1.9/ja/book/if.md +++ b/1.9/ja/book/if.md @@ -20,7 +20,6 @@ Rustにおける `if` の扱いは さほど複雑ではありませんが、伝 let x = 5; if x == 5 { -// println!("x is five!"); println!("x は 5 です!"); } ``` @@ -38,10 +37,8 @@ if x == 5 { let x = 5; if x == 5 { -// println!("x is five!"); println!("x は 5 です!"); } else { -// println!("x is not five :("); println!("x は 5 ではありません :("); } ``` @@ -53,13 +50,10 @@ if x == 5 { let x = 5; if x == 5 { -// println!("x is five!"); println!("x は 5 です!"); } else if x == 6 { -// println!("x is six!"); println!("x は 6 です!"); } else { -// println!("x is not five or six :("); println!("x は 5 でも 6 でもありません :("); } ``` From ad2682694c5729b41806ce908244d076dd9b7116 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Fri, 17 Jun 2016 22:29:26 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E7=BF=BB=E8=A8=B3=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=83=BC=E3=81=AB=E5=BE=93=E3=81=84=E3=80=81=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E8=A1=8C=E3=82=92=E5=85=83=E3=81=AB=E6=88=BB=E3=81=97?= =?UTF-8?q?=E3=81=9F=20-=20https://github.com/rust-lang-ja/the-rust-progra?= =?UTF-8?q?mming-language-ja/pull/156/files#r67497686?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.9/ja/book/if.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/1.9/ja/book/if.md b/1.9/ja/book/if.md index bcc8cd44..95918e57 100644 --- a/1.9/ja/book/if.md +++ b/1.9/ja/book/if.md @@ -20,6 +20,7 @@ Rustにおける `if` の扱いは さほど複雑ではありませんが、伝 let x = 5; if x == 5 { +# // println!("x is five!"); println!("x は 5 です!"); } ``` @@ -37,8 +38,10 @@ if x == 5 { let x = 5; if x == 5 { +# // println!("x is five!"); println!("x は 5 です!"); } else { +# // println!("x is not five :("); println!("x は 5 ではありません :("); } ``` @@ -50,10 +53,13 @@ if x == 5 { let x = 5; if x == 5 { +# // println!("x is five!"); println!("x は 5 です!"); } else if x == 6 { +# // println!("x is six!"); println!("x は 6 です!"); } else { +# // println!("x is not five or six :("); println!("x は 5 でも 6 でもありません :("); } ```