Skip to content

Commit 6ca764b

Browse files
committed
fix translation
- apply self-review - small refinement
1 parent d7a3404 commit 6ca764b

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

1.6/ja/book/loops.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
<!-- The infinite `loop` is the simplest form of loop available in Rust. Using the keyword `loop`, Rust provides a way to loop indefinitely until some terminating statement is reached. Rust's infinite `loop`s look like this: -->
1111
Rustで使えるループなかで最もシンプルな形式が、無限 `loop` です。Rustのキーワード `loop` によって、
12-
何らかの終了状態に到達するまでずっとループし続ける手段を提供します。
12+
何らかの終了状態に到達するまでずっとループし続ける手段を提供します。Rustの無限 `loop` はこのように:
1313

1414
```rust,ignore
1515
loop {
1616
# // println!("Loop forever!");
17-
println!("無限ループ!");
17+
println!("永久にループ!");
1818
}
1919
```
2020

@@ -50,7 +50,7 @@ while true {
5050
```
5151

5252
<!-- However, `loop` is far better suited to handle this case: -->
53-
しかし、このような状況では `loop` の方がずっと適しています。
53+
しかし、こういった場合には `loop` の方がずっと適しています。
5454

5555
```rust,ignore
5656
loop {
@@ -61,9 +61,9 @@ loop {
6161
<!-- we can give to the compiler, the better it can do with safety and code -->
6262
<!-- generation, so you should always prefer `loop` when you plan to loop -->
6363
<!-- infinitely. -->
64-
Rustの制御フロー解析では、必ずループが行われることから、これを `while true` とは異なる構造として扱います。
65-
一般に、コンパイラに与えられる情報量が多いほど、安全性が高くより良いコード生成につながるため、
66-
無限ループを行いたいならば常に `loop` を使うべきなのです
64+
Rustの制御フロー解析では、必ずループすると知っていることから、これを `while true` とは異なる構造として扱います。
65+
一般に、コンパイラへ与える情報量が多いほど、安全性が高くより良いコード生成につながるため、
66+
無限にループするつもりなら常に `loop` を使うべきです
6767

6868

6969
## for
@@ -133,7 +133,7 @@ Rustでは意図的に「Cスタイル」 `for` ループを持ちません。
133133
ループ中で何回目の繰り返しかを知る必要があるなら、 `.enumerate()` 関数が使えます。
134134

135135
<!-- #### On ranges: -->
136-
####️⃣ 範囲(range)を対象に:
136+
#### レンジを対象に:
137137

138138
```rust
139139
for (i,j) in (5..10).enumerate() {
@@ -153,7 +153,7 @@ i = 4 and j = 9
153153
```
154154

155155
<!-- Don't forget to add the parentheses around the range. -->
156-
範囲を括弧で囲うことを忘れないで
156+
レンジを括弧で囲うのを忘れないで下さい
157157

158158
<!-- #### On iterators: -->
159159
#### イテレータを対象に:
@@ -179,7 +179,7 @@ for (linenumber, line) in lines.enumerate() {
179179
## 反復の早期終了
180180

181181
<!-- Let’s take a look at that `while` loop we had earlier: -->
182-
早期終了を伴う `while` ループを見てみましょう:
182+
さきほどの `while` ループを見てみましょう:
183183

184184
```rust
185185
let mut x = 5;
@@ -199,11 +199,11 @@ while !done {
199199
<!-- We had to keep a dedicated `mut` boolean variable binding, `done`, to know -->
200200
<!-- when we should exit out of the loop. Rust has two keywords to help us with -->
201201
<!-- modifying iteration: `break` and `continue`. -->
202-
ループをいつ終了すべきか知るために、ここでは専用の `mut` なboolean変数束縛 `done` を用います
203-
Rustには繰り返しの変更を手伝う2つキーワードがあります: `break``continue` です
202+
ループをいつ終了すべきか知るため、ここでは専用の `mut` なboolean変数束縛 `done` を用いました
203+
Rustには反復の変更を手伝う2つキーワード: `break``continue` があります
204204

205205
<!-- In this case, we can write the loop in a better way with `break`: -->
206-
今回は`break` を使ってループを記述するのが良い方法です:
206+
この例では`break` を使ってループを記述した方が良いでしょう:
207207

208208
```rust
209209
let mut x = 5;
@@ -218,7 +218,7 @@ loop {
218218
```
219219

220220
<!-- We now loop forever with `loop` and use `break` to break out early. Issuing an explicit `return` statement will also serve to terminate the loop early. -->
221-
ここでは `loop` による無限ループと `break` による早期脱出を使っています。
221+
ここでは `loop` による永久ループと `break` による早期脱出を使っています。
222222
明示的な `return` 文の発行でもループの早期終了になります。
223223

224224
<!-- `continue` is similar, but instead of ending the loop, goes to the next -->
@@ -245,8 +245,9 @@ for x in 0..10 {
245245
<!-- `continue` statement applies to. This will only print when both `x` and `y` are -->
246246
<!-- odd: -->
247247
入れ子のループがあり、`break``continue` 文がどのループに対応するか指定する必要がある、
248-
そんな状況に出会うこともあるでしょう。多くの他言語と同様に、 `break``continue` は最内ループに適用されるのがデフォルトです。
249-
外側のループに `break``continue` を使いたいという状況では、 `break``continue` 文の適用先を指定するラベルを使えます。これは `x``y` 両方が奇数のときだけ表示します:
248+
そんな状況に出会うこともあるでしょう。大抵の他言語と同様に、 `break``continue` は最内ループに適用されるのがデフォルトです。
249+
外側のループに `break``continue` を使いたいという状況では、 `break``continue` 文の適用先を指定するラベルを使えます。
250+
これは `x``y` 両方が奇数のときだけ表示を行います:
250251

251252
```rust
252253
'outer: for x in 0..10 {

0 commit comments

Comments
 (0)