mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-31 11:01:46 +02:00
ru: day 2, afternoon; more control loops translation (#1095)
This commit is contained in:
parent
43dc4018f1
commit
91c4df3644
54
po/ru.po
54
po/ru.po
@ -166,11 +166,11 @@ msgstr "Выражение if"
|
|||||||
|
|
||||||
#: src/SUMMARY.md:47
|
#: src/SUMMARY.md:47
|
||||||
msgid "for expressions"
|
msgid "for expressions"
|
||||||
msgstr ""
|
msgstr "Выражение for"
|
||||||
|
|
||||||
#: src/SUMMARY.md:48
|
#: src/SUMMARY.md:48
|
||||||
msgid "while expressions"
|
msgid "while expressions"
|
||||||
msgstr ""
|
msgstr "Выражение while"
|
||||||
|
|
||||||
#: src/SUMMARY.md:49
|
#: src/SUMMARY.md:49
|
||||||
msgid "break & continue"
|
msgid "break & continue"
|
||||||
@ -219,7 +219,7 @@ msgstr "Выражение if let"
|
|||||||
|
|
||||||
#: src/SUMMARY.md:62
|
#: src/SUMMARY.md:62
|
||||||
msgid "while let expressions"
|
msgid "while let expressions"
|
||||||
msgstr ""
|
msgstr "Выражение while let"
|
||||||
|
|
||||||
#: src/SUMMARY.md:63
|
#: src/SUMMARY.md:63
|
||||||
msgid "match expressions"
|
msgid "match expressions"
|
||||||
@ -4276,6 +4276,9 @@ msgid ""
|
|||||||
"related to the [`while let` loop](while-let-expressions.md). It will "
|
"related to the [`while let` loop](while-let-expressions.md). It will "
|
||||||
"automatically call `into_iter()` on the expression and then iterate over it:"
|
"automatically call `into_iter()` on the expression and then iterate over it:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Выражение [`for`](https://doc.rust-lang.org/std/keyword.for.html) очень "
|
||||||
|
"похоже на выражение [`while let`](while-let-expressions.md). Оно неявно "
|
||||||
|
"вызывает `into_iter()` для итерируемого объекта:"
|
||||||
|
|
||||||
#: src/control-flow/for-expressions.md:7
|
#: src/control-flow/for-expressions.md:7
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -4296,37 +4299,46 @@ msgstr ""
|
|||||||
|
|
||||||
#: src/control-flow/for-expressions.md:21
|
#: src/control-flow/for-expressions.md:21
|
||||||
msgid "You can use `break` and `continue` here as usual."
|
msgid "You can use `break` and `continue` here as usual."
|
||||||
msgstr ""
|
msgstr "Здесь также можно изпользовать выражения `break` и `continue`."
|
||||||
|
|
||||||
#: src/control-flow/for-expressions.md:25
|
#: src/control-flow/for-expressions.md:25
|
||||||
msgid "Index iteration is not a special syntax in Rust for just that case."
|
msgid "Index iteration is not a special syntax in Rust for just that case."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"В языке Rust нет специального синтакса для итерации по идексам контейнеров."
|
||||||
|
|
||||||
#: src/control-flow/for-expressions.md:26
|
#: src/control-flow/for-expressions.md:26
|
||||||
msgid "`(0..10)` is a range that implements an `Iterator` trait. "
|
msgid "`(0..10)` is a range that implements an `Iterator` trait. "
|
||||||
msgstr ""
|
msgstr "`(0..10)` -- это диапазон, который реализует трейт `Iterator`. "
|
||||||
|
|
||||||
#: src/control-flow/for-expressions.md:27
|
#: src/control-flow/for-expressions.md:27
|
||||||
msgid ""
|
msgid ""
|
||||||
"`step_by` is a method that returns another `Iterator` that skips every other "
|
"`step_by` is a method that returns another `Iterator` that skips every other "
|
||||||
"element. "
|
"element. "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"`step_by` -- это метод, который возвращает итератор, который пропускает "
|
||||||
|
"каждый второй элемент. "
|
||||||
|
|
||||||
#: src/control-flow/for-expressions.md:28
|
#: src/control-flow/for-expressions.md:28
|
||||||
msgid ""
|
msgid ""
|
||||||
"Modify the elements in the vector and explain the compiler errors. Change "
|
"Modify the elements in the vector and explain the compiler errors. Change "
|
||||||
"vector `v` to be mutable and the for loop to `for x in v.iter_mut()`."
|
"vector `v` to be mutable and the for loop to `for x in v.iter_mut()`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Попробуйте присвоить что-нибудь к `x` и объясните ошибки компиляции, которые "
|
||||||
|
"при этом появятся. Сделайте `v` изменяемым и поменяйте цикл `for` на `for x "
|
||||||
|
"in v.iter_mut()`."
|
||||||
|
|
||||||
#: src/control-flow/while-expressions.md:1
|
#: src/control-flow/while-expressions.md:1
|
||||||
msgid "`while` loops"
|
msgid "`while` loops"
|
||||||
msgstr ""
|
msgstr "Выражение `while`"
|
||||||
|
|
||||||
#: src/control-flow/while-expressions.md:3
|
#: src/control-flow/while-expressions.md:3
|
||||||
msgid ""
|
msgid ""
|
||||||
"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-"
|
"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-"
|
||||||
"expr.html#predicate-loops) works very similar to other languages:"
|
"expr.html#predicate-loops) works very similar to other languages:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"[Ключевое слово `while`](https://doc.rust-lang.org/reference/expressions/"
|
||||||
|
"loop-expr.html#predicate-loops)\n"
|
||||||
|
"работает примерно так же, как и в других языках программирования"
|
||||||
|
|
||||||
#: src/control-flow/while-expressions.md:6
|
#: src/control-flow/while-expressions.md:6
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -4344,6 +4356,19 @@ msgid ""
|
|||||||
"}\n"
|
"}\n"
|
||||||
"```"
|
"```"
|
||||||
msgstr ""
|
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!(\"Конечное значение x: {x}\");\n"
|
||||||
|
"}\n"
|
||||||
|
"```"
|
||||||
|
|
||||||
#: src/control-flow/break-continue.md:1
|
#: src/control-flow/break-continue.md:1
|
||||||
msgid "`break` and `continue`"
|
msgid "`break` and `continue`"
|
||||||
@ -5279,7 +5304,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: src/control-flow/while-let-expressions.md:1
|
#: src/control-flow/while-let-expressions.md:1
|
||||||
msgid "`while let` loops"
|
msgid "`while let` loops"
|
||||||
msgstr ""
|
msgstr "Выражение `while let`"
|
||||||
|
|
||||||
#: src/control-flow/while-let-expressions.md:3
|
#: src/control-flow/while-let-expressions.md:3
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -5287,6 +5312,10 @@ msgid ""
|
|||||||
"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which "
|
"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which "
|
||||||
"repeatedly tests a value against a pattern:"
|
"repeatedly tests a value against a pattern:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Аналогично выражению `if let` существует [выражение`while let`](https://doc."
|
||||||
|
"rust-lang.org/reference/expressions/loop-expr.html#predicate-pattern-"
|
||||||
|
"loops),\n"
|
||||||
|
"которое в цикле проверяет сопоставление какого-либо выражения шаблону:"
|
||||||
|
|
||||||
#: src/control-flow/while-let-expressions.md:6
|
#: src/control-flow/while-let-expressions.md:6
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -5309,12 +5338,20 @@ msgid ""
|
|||||||
"it will return `None`. The `while let` lets us keep iterating through all "
|
"it will return `None`. The `while let` lets us keep iterating through all "
|
||||||
"items."
|
"items."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Здесь `next()`-итератор, возвращаемого выражением `v.into_iter()`, "
|
||||||
|
"возвращает объект типа `Option<i32>`.\n"
|
||||||
|
"Сначала будет возращаться `Some(x)` для каждого элемента вектора,\n"
|
||||||
|
"после чего `next()` вернет `None`. Выражение `while let` позволяет нам "
|
||||||
|
"лаконично\n"
|
||||||
|
"проитерировать все значения вектора."
|
||||||
|
|
||||||
#: src/control-flow/while-let-expressions.md:26
|
#: src/control-flow/while-let-expressions.md:26
|
||||||
msgid ""
|
msgid ""
|
||||||
"Point out that the `while let` loop will keep going as long as the value "
|
"Point out that the `while let` loop will keep going as long as the value "
|
||||||
"matches the pattern."
|
"matches the pattern."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Уточнить, что циклы `while let` будут продолжаться до тех пор, пока значение "
|
||||||
|
"будет соответствовать шаблону."
|
||||||
|
|
||||||
#: src/control-flow/while-let-expressions.md:27
|
#: src/control-flow/while-let-expressions.md:27
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -5322,6 +5359,9 @@ msgid ""
|
|||||||
"statement that breaks when there is no value to unwrap for `iter.next()`. "
|
"statement that breaks when there is no value to unwrap for `iter.next()`. "
|
||||||
"The `while let` provides syntactic sugar for the above scenario."
|
"The `while let` provides syntactic sugar for the above scenario."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Этот цикл можно переписать как бесконечный цикл, который прерывается, когда "
|
||||||
|
"результат `iter.next()` перестает соответствовать `Some(x)`. Выражение "
|
||||||
|
"`while let` позволяет описать ту же самую логику более лаконично."
|
||||||
|
|
||||||
#: src/control-flow/match-expressions.md:3
|
#: src/control-flow/match-expressions.md:3
|
||||||
msgid ""
|
msgid ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user