diff --git a/po/ko.po b/po/ko.po index 057893f1e05..f1691320c5c 100644 --- a/po/ko.po +++ b/po/ko.po @@ -6372,6 +6372,24 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let x = {\n" +" let y = 10;\n" +" println!(\"y: {y}\");\n" +" let z = {\n" +" let w = {\n" +" 3 + 4\n" +" };\n" +" println!(\"w: {w}\");\n" +" y * w\n" +" };\n" +" println!(\"z: {z}\");\n" +" z - y\n" +" };\n" +" println!(\"x: {x}\");\n" +"}\n" +"```" #: src/control-flow/blocks.md:25 msgid "" @@ -6423,7 +6441,7 @@ msgstr "# `if` 표현식" msgid "You use `if` very similarly to how you would in other languages:" msgstr "`if`는 다른 언어와 매우 유사합니다:" -#: src/control-flow/if-expressions.md:5 +#: src/control-flow/if-expressions.md:7 msgid "" "```rust,editable\n" "fn main() {\n" @@ -6436,12 +6454,22 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" if x % 2 == 0 {\n" +" x = x / 2;\n" +" } else {\n" +" x = 3 * x + 1;\n" +" }\n" +"}\n" +"```" #: src/control-flow/if-expressions.md:16 msgid "In addition, you can use it as an expression. This does the same as above:" msgstr "게다가 `if`는 표현식으로 사용할 수도 있습니다. 아래 코드는 위와 동일합니다:" -#: src/control-flow/if-expressions.md:18 +#: src/control-flow/if-expressions.md:22 msgid "" "```rust,editable\n" "fn main() {\n" @@ -6454,6 +6482,16 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +"}\n" +"```" #: src/control-flow/if-expressions.md:31 msgid "Because `if` is an expression and must have a particular type, both of its branch blocks must have the same type. Consider showing what happens if you add `;` after `x / 2` in the second example." @@ -6467,7 +6505,7 @@ msgstr "# `if let` 표현식" msgid "If you want to match a value against a pattern, you can use `if let`:" msgstr "어떤 값이 패턴에 매치되는지 검사하려면 `if let` 표현식을 사용하면 됩니다:" -#: src/control-flow/if-let-expressions.md:5 +#: src/control-flow/if-let-expressions.md:7 msgid "" "```rust,editable\n" "fn main() {\n" @@ -6480,6 +6518,16 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let arg = std::env::args().next();\n" +" if let Some(value) = arg {\n" +" println!(\"Program name: {value}\");\n" +" } else {\n" +" println!(\"Missing name?\");\n" +" }\n" +"}\n" +"```" #: src/control-flow/if-let-expressions.md:16 #: src/control-flow/while-let-expressions.md:21 @@ -6509,7 +6557,7 @@ msgstr "# `while` 표현식" msgid "The `while` keyword works very similar to other languages:" msgstr "`while` 역시 다른 언어과 매우 비슷합니다:" -#: src/control-flow/while-expressions.md:5 +#: src/control-flow/while-expressions.md:6 msgid "" "```rust,editable\n" "fn main() {\n" @@ -6525,6 +6573,19 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" while x != 1 {\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +" }\n" +" println!(\"Final x: {x}\");\n" +"}\n" +"```" #: src/control-flow/while-let-expressions.md:1 msgid "# `while let` expressions" @@ -6643,7 +6704,7 @@ msgid "" "either `break` or `return` to stop the loop:" msgstr "마지막으로 `loop`키워드는 무한 루프를 생성합니다. 따라서 반드시 `break` 또는 `return`을 사용해서 루프를 정지해야 합니다:" -#: src/control-flow/loop-expressions.md:6 +#: src/control-flow/loop-expressions.md:8 msgid "" "```rust,editable\n" "fn main() {\n" @@ -6662,6 +6723,22 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut x = 10;\n" +" loop {\n" +" x = if x % 2 == 0 {\n" +" x / 2\n" +" } else {\n" +" 3 * x + 1\n" +" };\n" +" if x == 1 {\n" +" break;\n" +" }\n" +" }\n" +" println!(\"Final x: {x}\");\n" +"}\n" +"```" #: src/control-flow/loop-expressions.md:25 msgid "* Break the `loop` with a value (e.g. `break 8`) and print it out." @@ -13754,6 +13831,126 @@ msgid "" "```" msgstr "" +#: src/control-flow/if-expressions.md:3 +msgid "" +"You use [`if`\n" +"expressions](https://doc.rust-lang.org/reference/expressions/if-expr.html#if-" +"expressions)\n" +"exactly like `if` statements in other languages:" +msgstr "" +"다른 언어의 `if` 문과 똑같이\n" +"[`if` 표현식](https://doc.rust-lang.org/reference/expressions/if-expr." +"html#if-expressions)을\n" +"사용합니다." + +#: src/control-flow/if-let-expressions.md:3 +msgid "" +"The [`if let`\n" +"expression](https://doc.rust-lang.org/reference/expressions/if-expr.html#if-" +"let-expressions)\n" +"lets you execute different code depending on whether a value matches a " +"pattern:" +msgstr "" +"[`if let` 표현식](https://doc.rust-lang.org/reference/expressions/if-expr." +"html#if-let-expressions)을\n" +"사용하면 값이 패턴과 일치하는지에 따라 다른 코드를\n" +"실행할 수 있습니다." + +#: src/control-flow/if-let-expressions.md:23 +msgid "" +"* `if let` can be more concise than `match`, e.g., when only one case is " +"interesting. In contrast, `match` requires all branches to be covered.\n" +"* A common usage is handling `Some` values when working with `Option`.\n" +"* Unlike `match`, `if let` does not support guard clauses for pattern " +"matching.\n" +"* Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" +"flow_control/let_else.html) construct allows to do a destructuring " +"assignment, or if it fails, have a non-returning block branch (panic/return/" +"break/continue):\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" +" }\n" +" \n" +" fn second_word_to_upper(s: &str) -> Option {\n" +" let mut it = s.split(' ');\n" +" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" +" return None;\n" +" };\n" +" Some(item.to_uppercase())\n" +" }" +msgstr "" +"* `if let`이 `match`보다 더 간결할 수 있습니다(예: 한가지 브랜치만 흥미로운 경" +"우). 이와 달리 `match`에서는 모든 브랜치가 처리되어야 합니다.\n" +"* 일반적 사용법은 `Option`을 사용할 때 `Some` 값을 처리하는 것입니다.\n" +"* `match`와 달리 `if let`은 패턴 일치를 위한 보호 절을 지원하지 않습니다.\n" +"* 1.65부터 유사한 [let-else](https://doc.rust-lang.org/rust-by-example/" +"flow_control/let_else.html) 구성은 디스트럭처링 할당을 실행하거나 실패할 경" +"우 반환되지 않는 블록 브랜치(panic/return/break/continue)를 보유하도록 허용합" +"니다.\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" +" }\n" +" \n" +" fn second_word_to_upper(s: &str) -> Option {\n" +" let mut it = s.split(' ');\n" +" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" +" return None;\n" +" };\n" +" Some(item.to_uppercase())\n" +" }" + +#: src/control-flow/while-expressions.md:3 +msgid "" +"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#predicate-loops)\n" +"works very similar to other languages:" +msgstr "" +"[`while` 키워드](https://doc.rust-lang.org/reference/expressions/loop-expr." +"html#predicate-loops)는 다른 언어와 매우 비슷하게\n" +"작동합니다." + +#: src/control-flow/loop-expressions.md:3 +msgid "" +"Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#infinite-loops)\n" +"which creates an endless loop." +msgstr "" +"마지막으로, 무한 루프를 만드는 [`loop` 키워드](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#infinite-loops)가\n" +"있습니다." + +#: src/control-flow/loop-expressions.md:27 +msgid "" +"* Break the `loop` with a value (e.g. `break 8`) and print it out.\n" +"* Note that `loop` is the only looping construct which returns a non-" +"trivial\n" +" value. This is because it's guaranteed to be entered at least once " +"(unlike\n" +" `while` and `for` loops)." +msgstr "" +"* `loop`를 값(예: `break 8`)으로 나누고 출력합니다.\n" +"* `loop`는 non-trivial 값을 반환하는 유일한\n" +" 반복문입니다. 이는 `while` 및 `for` 반복문과 달리 최소한 한 번은 루프문을 수행하는 것이\n" +" 보장되기 때문입니다." + +#: src/control-flow/break-continue.md:3 +msgid "" +"- If you want to exit a loop early, use [`break`](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#break-expressions),\n" +"- If you want to immediately start\n" +"the next iteration use [`continue`](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#continue-expressions)." +msgstr "" +"- 루프를 조기에 종료하려면 [`break`](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#break-expressions)를 사용합니다.\n" +"- 다음 반복을 즉시 시작하려면\n" +"[`continue`](https://doc.rust-lang.org/reference/expressions/loop-expr." +"html#continue-expressions)를 사용합니다." + #: src/SUMMARY.md:34 msgid "Rustdoc" msgstr "Rustdoc" @@ -13967,3 +14164,4 @@ msgstr "" " println!(\"You got: {:?}\", flip_coin());\n" "}\n" "```" +