From 7af7b499d3e2019e1c78be7ad5ad22782360f0cd Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Tue, 17 Aug 2021 01:49:37 +0400 Subject: [PATCH 01/30] article while loops --- 1-js/02-first-steps/13-while-for/article.md | 100 ++++++++++---------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 3045477d6..8caa8bb22 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -1,54 +1,54 @@ -# Loops: while and for +# Ցիկլեր․ while և for -We often need to repeat actions. +Հաճախ մենք կարիք ենք ունենում կրկնել ինչ֊որ գործողությունների հետթականություն։ -For example, outputting goods from a list one after another or just running the same code for each number from 1 to 10. +Օրինակ․ տպել իրար հետևից ցուցակի մեջ գտնվող ապրանքները, կամ ուղղակի աշխակատցնել նույն կոդը 1֊ից 10 բոլոր թվերի համար։ -*Loops* are a way to repeat the same code multiple times. +*Ցիկլերը* նույն կոդը մի քանի անգամ կրկնելու հնարավորություն են տալիս։ -## The "while" loop +## "while" ցիկլը -The `while` loop has the following syntax: +`while` ցիկլը ունի հետևյալ գրելաձևը․ ```js while (condition) { - // code - // so-called "loop body" + // կոդը + // որին նաև ասում են "ցիկլի մարմին" ("loop body") } ``` -While the `condition` is truthy, the `code` from the loop body is executed. +Քանի դեռ `condition`֊ը (պայմանը) ճշմարիտ է, `կոդը` ցիկլի մարմնի ներսում կկատարվի։ -For instance, the loop below outputs `i` while `i < 3`: +Օրինակի համար, ներքևի ցիկլը կարտածի `i`, քանի դեռ `i < 3`․ ```js run let i = 0; -while (i < 3) { // shows 0, then 1, then 2 +while (i < 3) { // ցույց կտա 0, հետո 1, հետո 2 alert( i ); i++; } ``` -A single execution of the loop body is called *an iteration*. The loop in the example above makes three iterations. +Ցիկլի մարմնի մի կատարումը անվանում են *իտերացիա* (*an iteration*): Ցիկլը վերևի օրինակում կատարում է երեք իտերացիա։ -If `i++` was missing from the example above, the loop would repeat (in theory) forever. In practice, the browser provides ways to stop such loops, and in server-side JavaScript, we can kill the process. +Եթե չլիներ `i++` գործողությունը վերևի օրինակում, ապա ցիկլը կկրկնվեր (տեսականորեն) անվերջ։ Պրակտիկայում, դիտարկիչը (browser) կտրամադրի տարբեր գործիքներ, որոնց միջոցով կկարողանանք կանգնեցնել այդպիսի ցիկլկերը, և սերվերում (server-side) կիրառվող JavaScript֊ում կարող ենք սպանել (kill) այդ պրոցեսը։ -Any expression or variable can be a loop condition, not just comparisons: the condition is evaluated and converted to a boolean by `while`. +Կամայական արտահայտություն կամ փոփոխական կարող է լինել ցիկլի պայման։ Պայմանը հաշվվում և ձևափոխվում է տրամաբանական տիպի `while`֊ի կողմից։ -For instance, a shorter way to write `while (i != 0)` is `while (i)`: +Օրինակի համար, `while (i != 0)` արտահայտության կարճ գրելաձևը կլինի `while (i)`: ```js run let i = 3; *!* -while (i) { // when i becomes 0, the condition becomes falsy, and the loop stops +while (i) { // երբ i֊ն դառնա 0, պայմանը կդառնա սխալական, և ցիկլը կանգ կառնի */!* alert( i ); i--; } ``` -````smart header="Curly braces are not required for a single-line body" -If the loop body has a single statement, we can omit the curly braces `{…}`: +````smart header="Ձևավոր փակագծերը պարտադիր չեն մեկ տողանի մարմնի համար" +Եթե ցիկլի մարմինը ունի ընդամենը մեկ արտահայտություն (statement), ապա կարող ենք բաց թողնել ձևավոր փակագծերը `{…}`․ ```js run let i = 3; @@ -58,19 +58,19 @@ while (i) alert(i--); ``` ```` -## The "do..while" loop +## "do..while" ցիկլը -The condition check can be moved *below* the loop body using the `do..while` syntax: +Պայմանի ստուգումը կարելի է տեղափոխել ցիկլի մարմնի *ներքևը* օգտագործելով `do..while` գերլաձևը․ ```js do { - // loop body + // ցիկլի մարմին } while (condition); ``` -The loop will first execute the body, then check the condition, and, while it's truthy, execute it again and again. +Ցիկլը սկզբում կաշխատացնի մարմնը, ապա կստուգի պայմանը, և քանի դեռ այն ճշմարիտ է, այն կաշխատացնի մարմինը նորից ու նորից։ -For example: +Օրինակ․ ```js run let i = 0; @@ -80,68 +80,68 @@ do { } while (i < 3); ``` -This form of syntax should only be used when you want the body of the loop to execute **at least once** regardless of the condition being truthy. Usually, the other form is preferred: `while(…) {…}`. +Այս գրելաձևը պետք է օգտագործվի միայն այն դեպքում, երբ ցանկանում եք, որ ցիկլի մարմինը աշխատի **առնվազն մեկ անգամ** անկախ պայմանի ճշմարիտ կամ սխալական լինելու փաստից։ Սովորաբար մյուս տեսքը ավելի նախընտրելի է․ `while(…) {…}`։ -## The "for" loop +## "for" ցիկլը -The `for` loop is more complex, but it's also the most commonly used loop. +`for` ցիլկը ավելի կոմպլեքս է, բայց այն ամենից շատ կիրառվող ցիկլն է։ -It looks like this: +Այն ունի հետևյալ տեսքը․ ```js for (begin; condition; step) { - // ... loop body ... + // ... ցիկլի մարմին ... } ``` -Let's learn the meaning of these parts by example. The loop below runs `alert(i)` for `i` from `0` up to (but not including) `3`: +Եկեք ուսումնասիրենք այդ մասեիը օրինակի վրա։ Ներքևի ցիկլը կատարում է `alert(i)` հրամանը `i`֊ն `0`֊ից մինչև `3`֊ը ոչ ներառյալ: ```js run -for (let i = 0; i < 3; i++) { // shows 0, then 1, then 2 +for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 alert(i); } ``` -Let's examine the `for` statement part-by-part: +Դիտարկենք `for`֊ը մաս֊առ֊մաս․ -| part | | | +| մաս | | | |-------|----------|----------------------------------------------------------------------------| -| begin | `i = 0` | Executes once upon entering the loop. | -| condition | `i < 3`| Checked before every loop iteration. If false, the loop stops. | -| body | `alert(i)`| Runs again and again while the condition is truthy. | -| step| `i++` | Executes after the body on each iteration. | +| սկիզբ | `i = 0` | Կատարվում է, երբ մտնում ենք ցիկլ։ | +| պայման | `i < 3`| Ստուգվում է ցիկլի ամեն իտերացիայից առաջ։ Եթե այն սխալ է, ապա ցիկլը կանգնեցվում է։ | +| մարմին | `alert(i)`| Աշխատում է այնքան ժամանակ, քանի դեռ պայմանը ճշմարիտ է։ | +| քայլ| `i++` | Կատարվում է մարմնի կատարումից հետո, ամեն իտերացիայից ժամանակ։ | -The general loop algorithm works like this: +Ընդհանուր դեպքում ալգորիթմը աշխատում է հետևյալ կերպ․ ``` -Run begin -→ (if condition → run body and run step) -→ (if condition → run body and run step) -→ (if condition → run body and run step) +Աշխատացնել *սկիզբ* +→ (եթե *պայման* → կատարել *մարմին* և աշխատացնել *քայլ*) +→ (եթե *պայման* → կատարել *մարմին* և աշխատացնել *քայլ*) +→ (եթե *պայման* → կատարել *մարմին* և աշխատացնել *քայլ*) → ... ``` -That is, `begin` executes once, and then it iterates: after each `condition` test, `body` and `step` are executed. +Այսինքն, `սկիզբ`֊ը կատարվում է մեկ անգամ, և հետո սկսվում են իտերացիաները․ ամեն `պայման`֊ի ստուգումից հետո, `մարմին`֊ը և `քայլ`֊ը կատարվում են։ -If you are new to loops, it could help to go back to the example and reproduce how it runs step-by-step on a piece of paper. +Եթե ցիկլերի թեման նոր է ձեր համար, ապա օգտակար կլինի հետ գնալ օրինակներին և քայլ֊առ֊քայլ գրառել դրանց կատարման ընթացքները թղթի վրա։ -Here's exactly what happens in our case: +Ահա թե ինչ է տեղի ունենում կոնկրետ մեր օրինակի դեպքում․ ```js // for (let i = 0; i < 3; i++) alert(i) -// run begin +// աշխատացնել սկիզբը let i = 0 -// if condition → run body and run step +// եթե պայման → կատարել մարմինը և աշխատացնել քայլը if (i < 3) { alert(i); i++ } -// if condition → run body and run step +// եթե պայման → կատարել մարմինը և աշխատացնել քայլը if (i < 3) { alert(i); i++ } -// if condition → run body and run step +// եթե պայման → կատարել մարմինը և աշխատացնել քայլը if (i < 3) { alert(i); i++ } -// ...finish, because now i == 3 +// ...ավարտ, քանի որ i == 3 ``` -````smart header="Inline variable declaration" +````smart header="Փոփոխականի ներկառուցված հայտարարում" Here, the "counter" variable `i` is declared right in the loop. This is called an "inline" variable declaration. Such variables are visible only inside the loop. ```js run From 8f4f536f082799d5b01aae28d6b9d89805f486e3 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Wed, 18 Aug 2021 23:26:18 +0400 Subject: [PATCH 02/30] break translated --- 1-js/02-first-steps/13-while-for/article.md | 48 ++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 8caa8bb22..bd68203cf 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -142,47 +142,47 @@ if (i < 3) { alert(i); i++ } ``` ````smart header="Փոփոխականի ներկառուցված հայտարարում" -Here, the "counter" variable `i` is declared right in the loop. This is called an "inline" variable declaration. Such variables are visible only inside the loop. +Այստեղ "հաշվիչ" փոփոխական `i`֊ն հայտարարված է հենց ցիկլի վրա։ Այն կոչվում է "ներկառուցված" փոփոխականի հայտարարում։ Այսպիսի փոփոխականները տեսանելի են միայն ցիկլի ներսում։ ```js run for (*!*let*/!* i = 0; i < 3; i++) { alert(i); // 0, 1, 2 } -alert(i); // error, no such variable +alert(i); // սխալ է, չկա այդպիսի փոփոխական ``` -Instead of defining a variable, we could use an existing one: +Փոփոխական հայտարարելու փոխարեն մենք կարող ենք օգտագործել արդեն գոյություն ունեցողը։ ```js run let i = 0; -for (i = 0; i < 3; i++) { // use an existing variable +for (i = 0; i < 3; i++) { // օգտագործվում է գոյություն ունեցող փոփոխական alert(i); // 0, 1, 2 } -alert(i); // 3, visible, because declared outside of the loop +alert(i); // 3, տեսանելի է, քանի որ հայտարարված է ցիկլից դուրս ``` ```` -### Skipping parts +### Մասերի բաց թողում -Any part of `for` can be skipped. +`for` ցիկլի ամեն մաս կաող է բաց թողնվել։ -For example, we can omit `begin` if we don't need to do anything at the loop start. +Օրինակ, կարող ենք բաց թողնել `սկիզբ`֊ը, եթե ցիկլի սկզբում գործողություն չունենք անելու։ -Like here: +Ինչպես այստեղ․ ```js run -let i = 0; // we have i already declared and assigned +let i = 0; // i֊ն արդեն հայտարարված և արժեք ստացած է -for (; i < 3; i++) { // no need for "begin" +for (; i < 3; i++) { // կարիք չկա "սկիզբ"֊ի alert( i ); // 0, 1, 2 } ``` -We can also remove the `step` part: +Մենք կարող ենք նաև հեռացնել `քայլ`֊ի հատվածը․ ```js run let i = 0; @@ -192,32 +192,32 @@ for (; i < 3;) { } ``` -This makes the loop identical to `while (i < 3)`. +Այն դառնում է նույնաբար `while (i < 3)` ցիկլը։ -We can actually remove everything, creating an infinite loop: +Մենք կարող ենք հեռացնել ամեն բան, և կստանանք անվերջ ցիկլ․ ```js for (;;) { - // repeats without limits + // կրկնվում է անվերջ } ``` -Please note that the two `for` semicolons `;` must be present. Otherwise, there would be a syntax error. +Նկատի ունեցեք, որ `for`֊ի երկու կետ ստորակետները `;` պարտադիր պետք է գրված լինեն, հակառակ դեպքում տեղի կունենա սինտաքսի սխալ (syntax error)։ -## Breaking the loop +## Ցիկլի ընդհատում (break) -Normally, a loop exits when its condition becomes falsy. +Սովորական դեպքերում ցիկլը դուրս է գալիս (ավարտվում է) այն ժամանակ, երբ նրա պայմանը դառնում է սխալական։ -But we can force the exit at any time using the special `break` directive. +Բայց մենք կարող ենք հարկադրաբար (force) դուրս գալ ցիկլից, ամեն պահի, օգտագործելով հատուկ դիրեկտիվ `break`֊ը։ -For example, the loop below asks the user for a series of numbers, "breaking" when no number is entered: +Օրինակ ներքևի ցիկլը օգտատիրոջից անընդհատ թվային մուտք է ուզում, "ընդհատվում" է, երբ ոչ թվային արժեք է մուտքագրվում․ ```js run let sum = 0; while (true) { - let value = +prompt("Enter a number", ''); + let value = +prompt("Մուտքագրեք թիվ", ''); *!* if (!value) break; // (*) @@ -226,12 +226,12 @@ while (true) { sum += value; } -alert( 'Sum: ' + sum ); +alert( 'Գումարը՝ ' + sum ); ``` -The `break` directive is activated at the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing control to the first line after the loop. Namely, `alert`. +`break` դիրեկտիվը կատարվում է `(*)` տողում, եթե օգտատերը մուտքագրում է դատարկ տող կամ չեղարկում է ներմուծման դաշտը։ Այն անմիջապես դադարեցնում է ցիկլը, և փոխանցում կատարումը ցիկլի անմիջապես հաջորդող տողին։ Մեր դեպքում՝ `alert`։ -The combination "infinite loop + `break` as needed" is great for situations when a loop's condition must be checked not in the beginning or end of the loop, but in the middle or even in several places of its body. +"Անվերջ ցիկլ + `break`" կոմբինացիան հիանալի լուծում է այն դեպքերի համար, երբ ցիկլի պայմանը պետք է ստուգվի ոչ թե սկզբում կամ վերջում, այլ ցիկլի մարմնի մեջ, նույնիսկ կարող է ստուգվել մի քանի տեղ։ ## Continue to the next iteration [#continue] From 794be86a9aa7dccac932efc14cdd92034e93d977 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Fri, 20 Aug 2021 22:46:09 +0400 Subject: [PATCH 03/30] article done --- 1-js/02-first-steps/13-while-for/article.md | 104 ++++++++++---------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index bd68203cf..359626362 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -233,28 +233,28 @@ alert( 'Գումարը՝ ' + sum ); "Անվերջ ցիկլ + `break`" կոմբինացիան հիանալի լուծում է այն դեպքերի համար, երբ ցիկլի պայմանը պետք է ստուգվի ոչ թե սկզբում կամ վերջում, այլ ցիկլի մարմնի մեջ, նույնիսկ կարող է ստուգվել մի քանի տեղ։ -## Continue to the next iteration [#continue] +## Շարունակել հաջորդ իտերացիայից [#continue] -The `continue` directive is a "lighter version" of `break`. It doesn't stop the whole loop. Instead, it stops the current iteration and forces the loop to start a new one (if the condition allows). +`continue` դիրեկտիվը `break`֊ի ավելի "թեթև տարբերակն" է։ Այն չի կանգնեցնում ամբողջ ցիկլը, այլ կանգնեցնում է միայն ընթացիկ իտերացիան, և հարկադրում ցիկլին անցնել հաջորդին (եթե պայմանը ճշմարիտ է)։ -We can use it if we're done with the current iteration and would like to move on to the next one. +Մենք կարող ենք օգտագործել այն, եթե այլևս կարիք չկա շարունակել այդ պահի իտերացիան և ցանկանում ենք անցնել հաջորդին։ -The loop below uses `continue` to output only odd values: +Ներքև ցիկլը օգտագործում է `continue`֊ն ցուցադրելու միայն կենտ արժեքները․ ```js run no-beautify for (let i = 0; i < 10; i++) { - // if true, skip the remaining part of the body + // եթե ճիշտ է, բաց է թողնում ցիկլի մարմնի ներքևի հատվածը *!*if (i % 2 == 0) continue;*/!* - alert(i); // 1, then 3, 5, 7, 9 + alert(i); // 1, հետո 3, 5, 7, 9 } ``` -For even values of `i`, the `continue` directive stops executing the body and passes control to the next iteration of `for` (with the next number). So the `alert` is only called for odd values. +`i`֊ի զույգ արժեքների համար `continue` դիրեկտիվը կանգնեցնում է մարմնի կատարումը և կատարումը փոխանցում `for`֊ի հաջորդ իտերացիային (հաջորդ թվով)։ Այսպիսով, `alert`֊ը կանչվում է միայն կենտ արժեքների համար։ -````smart header="The `continue` directive helps decrease nesting" -A loop that shows odd values could look like this: +````smart header="`continue` դիրեկտիվը օգնում է քչացնել ներդրվածությունները" +Ցիկլը, որը ցույց է տալիս միայն կենտ արժեքները կարող էր ունենալ հետևյալ տեսքը․ ```js run for (let i = 0; i < 10; i++) { @@ -266,15 +266,15 @@ for (let i = 0; i < 10; i++) { } ``` -From a technical point of view, this is identical to the example above. Surely, we can just wrap the code in an `if` block instead of using `continue`. +Տեխնիկական տեսանկյունից վերևում բերված երկու օրինակները ամբողջովին նույնն են։ Իհարկե, մենք կարող ենք շրջապատել մեր կոդի այդ հատվածը `if` բլոկով, `continue`֊ի փոխարեն։ -But as a side-effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of `if` is longer than a few lines, that may decrease the overall readability. +Բայց մենք կստանանք լրացուցիչ ներդրված բլոկներ (`alert`֊ի կանչումը ձևավոր փակագծերի ներսում)։ Եթե `if`֊ի ներսի կոդը մի քանի տողից երկար է, ապա այն կարող է նվազեցնել ընդհանուր ծրագրի ընթեռնելիությունը։ ```` -````warn header="No `break/continue` to the right side of '?'" -Please note that syntax constructs that are not expressions cannot be used with the ternary operator `?`. In particular, directives such as `break/continue` aren't allowed there. +````warn header="Ոչ մի `break/continue` '?'֊ի աջ կողմում" +Ուշադրություն դարձրեք, որ սինտաքսիկ կոնդտրուկցիաները (syntax constructs) չեն հանդիիսանում արտահայտություններ (expressions) և չեն կարող օգտագործվել `?` օպերատորի հետ։ Մասնավոր դեպքում, դիրեկտիվները ինչպիսիք են `break/continue` թույլատրված չեն '?'֊ի հետ։ -For example, if we take this code: +Օրինակի համար, եթե դիտարկենք այս ծրագիրը․ ```js if (i > 5) { @@ -284,114 +284,114 @@ if (i > 5) { } ``` -...and rewrite it using a question mark: +...և ձևափոխենք այն օգտագործելով հարցականի նշանը․ ```js no-beautify -(i > 5) ? alert(i) : *!*continue*/!*; // continue isn't allowed here +(i > 5) ? alert(i) : *!*continue*/!*; // continue֊ն թույլատրված չէ այստեղ ``` -...it stops working: there's a syntax error. +...այն կդադարի աշխատել, քանի որ կա սինտաքսի սխալ։ -This is just another reason not to use the question mark operator `?` instead of `if`. +Սա մեկ այլ պատճառ է, որպեսզի չօգտագործենք `?`֊ը `if`֊ի փոխարեն։ ```` -## Labels for break/continue +## Պիտակներ (labels) break֊ի և continue֊ի համար -Sometimes we need to break out from multiple nested loops at once. +Կան դեպքեր, երբ մենք ցանկանում ենք դուրս գալ միանգամից մի քանի դերդրված ցիկլերից միանգամից։ -For example, in the code below we loop over `i` and `j`, prompting for the coordinates `(i, j)` from `(0,0)` to `(2,2)`: +Օրինակ, ներքևի ծրագրում մենք անցնում ենք ցիկլ `i` և `j` փոփոխականներով, `prompt`-ի օգնությամբ հարցնում `(i, j)` կոորդինատների համար արժեք, սկսած `(0,0)` մինչև `(2,2)`․ ```js run no-beautify for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { - let input = prompt(`Value at coords (${i},${j})`, ''); + let input = prompt(`Արժեքը (${i},${j}) կոորդինատում`, ''); - // what if we want to exit from here to Done (below)? + // ինչ եթե ցանկանում ենք դուրս գալ այստեղից, և անցնել Պատրաստ է (ներքև) տողին? } } -alert('Done!'); +alert('Պատրաստ է!'); ``` -We need a way to stop the process if the user cancels the input. +Մեզ պետք է ինչ֊որ ձև կանգնեցնել պրոցեսը, եթե օգտատերը չեղարկել է ներմուծման դաշտը։ -The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue! +Ստանդարտ `break`֊ը `input`֊ից հետօ կկանգնեցնի միայն ներսի ցիկլը։ Դա բավարար չէ, և այստեղ է, որ պիտակները գալիս են օգնության։ -A *label* is an identifier with a colon before a loop: +*Պիտակը* դա նույնականացուցիչ (identifier) է վերջակետով ցիկլից առաջ․ ```js labelName: for (...) { ... } ``` -The `break ` statement in the loop below breaks out to the label: +`break ` հրամանը ներքևի ցիկլում կանգնեցնում է դրսի ցիկլը և անցնում պիտակի ցիկլի վերջը․ ```js run no-beautify *!*outer:*/!* for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { - let input = prompt(`Value at coords (${i},${j})`, ''); + let input = prompt(`Արժեքը (${i},${j}) կոորդինատում`, ''); - // if an empty string or canceled, then break out of both loops + // եթե դատարկ տող է կամ չեղարկված, ապա երկու ցիկլերն էլ կանգնեցվում են if (!input) *!*break outer*/!*; // (*) - // do something with the value... + // արժեքի հետ ինչ֊որ գործողություն... } } -alert('Done!'); +alert('Պատրաստ է!'); ``` -In the code above, `break outer` looks upwards for the label named `outer` and breaks out of that loop. +Վերևի ծրագրում `break outer`֊ը ման է գալիս իրեն ընդգրկող դրսի ցիկլ, որի պիտակը `outer` է, և կանգնեցնում այն։ -So the control goes straight from `(*)` to `alert('Done!')`. +Այդպիսով կատարում `(*)`֊ից գնում է միանգամից `alert('Done!')`։ -We can also move the label onto a separate line: +Մենք նաև կարոց ենք պիտակները տեղադրել ուրիշ տողում․ ```js no-beautify outer: for (let i = 0; i < 3; i++) { ... } ``` -The `continue` directive can also be used with a label. In this case, code execution jumps to the next iteration of the labeled loop. +`continue` դիրեկտիվը նույնպես կարող է կիրառվել պիտակների հետ։ Այս դեպքում, ծրագրի կատարումը անցնում է նշված պիտակով ցիկլի հաջորդ իտերացիային։ -````warn header="Labels do not allow to \"jump\" anywhere" -Labels do not allow us to jump into an arbitrary place in the code. +````warn header="Պիտակները թույլ չեն տալիս \"ցատկել\" կամայական տեղ" +Պիտակները թույլ չեն տալիս մեզ ցատկել ծրագրի լրիվ այլ հատված։ -For example, it is impossible to do this: +Օրինակ, անհնար է անել այսպիրի հնարք․ ```js -break label; // jump to the label below (doesn't work) +break label; // ցատկ ներքևի պիտակին (չի աշխատի) label: for (...) ``` -A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.: +`break` դիրեկտիվը պետք է լինի պիտակը պարունակող բլոկի ներսում։ Տեխնիկորեն կամայական պիտակավորված բլոկի համար կարող ենք անել հետևյալը․ ```js label: { // ... - break label; // works + break label; // կաշխատի // ... } ``` -...Although, 99.9% of the time `break` is used inside loops, as we've seen in the examples above. +...Չնայած դրան, 99.9% դեպքերում `break`֊ը օգտագործվում է ցիկլերի ներսում, ինչպես տեսանք վերևի օրինակում։ -A `continue` is only possible from inside a loop. +`continue`֊ն միայն հնարավոր է կիրառել ցիկլի ներսում։ ```` -## Summary +## Ամփոփում -We covered 3 types of loops: +Մենք դիտարկեցինք ցիկլերի 3 տիպ․ -- `while` -- The condition is checked before each iteration. -- `do..while` -- The condition is checked after each iteration. -- `for (;;)` -- The condition is checked before each iteration, additional settings available. +- `while` -- Ստուգվում է պայմանը ամեն իտերացիայից առաջ։ +- `do..while` -- Ստուգվում է պայմանը ամեն իտերացիայից հետո։ +- `for (;;)` -- Ստուգվում է պայմանը ամեն իտերացիայից առաջ, և տալիս լրացուցիչ կարգավորումների հնարավորություն -To make an "infinite" loop, usually the `while(true)` construct is used. Such a loop, just like any other, can be stopped with the `break` directive. +"Անվերջ" ցիկլ ստանալու համար սովորաբար օգտագործում են `while(true)`։ Այս ցիկլը, ինչպես նաև կամայական այլ ցիկլ, կարող է կանգնեցվել `break` դիրեկտիվի միջոցով։ -If we don't want to do anything in the current iteration and would like to forward to the next one, we can use the `continue` directive. +Եթե մենք չենք ուզում, որ աշխատի ընթացիկ իտերացիան, այլ ցանկանում ենք անցնել հաջորդին, ապա կարող ենք օգտագործել `continue` դիրեկտիվը։ -`break/continue` support labels before the loop. A label is the only way for `break/continue` to escape a nested loop to go to an outer one. +`break/continue` կարող են կիրառվել ցիկլերից առաջ գրված պիտակների վրա։ Պիտակը միակ ձևն է `break/continue`֊ի միջոցով ներդրված ցիկլերից դրսի ցիկլը կանգնեցնելու կամ դրա հաջորդ իտերացիային անցնելու համար։ From 371b28c14d71ec41c4be5dc2a1acc77bf934126f Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Fri, 20 Aug 2021 22:58:33 +0400 Subject: [PATCH 04/30] ex1 translated --- .../13-while-for/1-loop-last-value/solution.md | 14 +++++++------- .../13-while-for/1-loop-last-value/task.md | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/1-loop-last-value/solution.md b/1-js/02-first-steps/13-while-for/1-loop-last-value/solution.md index 43ee4aad3..11a87cff2 100644 --- a/1-js/02-first-steps/13-while-for/1-loop-last-value/solution.md +++ b/1-js/02-first-steps/13-while-for/1-loop-last-value/solution.md @@ -1,4 +1,4 @@ -The answer: `1`. +Պատասխան՝ `1`։ ```js run let i = 3; @@ -8,18 +8,18 @@ while (i) { } ``` -Every loop iteration decreases `i` by `1`. The check `while(i)` stops the loop when `i = 0`. +Ցիկլի ամեն իտերացիա `i`֊ն նվազեցնում է `1`֊ով։ `while(i)` ստուգումը կանգ կառնի, երբ `i = 0`։ -Hence, the steps of the loop form the following sequence ("loop unrolled"): +Հետևաբար ցիկլը բաղկացած կլինի հետևյալ քայլերից ("բացենք ցիկլը")․ ```js let i = 3; -alert(i--); // shows 3, decreases i to 2 +alert(i--); // ցույց կտա 3, կնվազեցնի i֊ն 1֊ով՝ դարձնելով 2 -alert(i--) // shows 2, decreases i to 1 +alert(i--) // ցույց կտա 2, կնվազեցնի i֊ն 1֊ով՝ դարձնելով 1 -alert(i--) // shows 1, decreases i to 0 +alert(i--) // ցույց կտա 1, կնվազեցնի i֊ն 1֊ով՝ դարձնելով 0 -// done, while(i) check stops the loop +// վերջ, while(i) ստուգումը կդադարեցնի ցիկլը ``` diff --git a/1-js/02-first-steps/13-while-for/1-loop-last-value/task.md b/1-js/02-first-steps/13-while-for/1-loop-last-value/task.md index 3b847dfa2..6254eb49e 100644 --- a/1-js/02-first-steps/13-while-for/1-loop-last-value/task.md +++ b/1-js/02-first-steps/13-while-for/1-loop-last-value/task.md @@ -2,9 +2,9 @@ importance: 3 --- -# Last loop value +# Ցիկլի վերջին արժեքը -What is the last value alerted by this code? Why? +Ի՞նչ արժեք ցույց կտա այս ծրագիրը ամենավերջում և ինչու՞։ ```js let i = 3; From 88e3ddd4b7c1cb5166689939dde54de8bebf7711 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 16:44:08 +0400 Subject: [PATCH 05/30] exs translated --- .../2-which-value-while/solution.md | 22 +++++++++---------- .../13-while-for/2-which-value-while/task.md | 10 ++++----- .../3-which-value-for/solution.md | 14 ++++++------ .../13-while-for/3-which-value-for/task.md | 10 ++++----- .../13-while-for/4-for-even/solution.md | 2 +- .../13-while-for/4-for-even/task.md | 4 ++-- .../5-replace-for-while/solution.md | 2 +- .../13-while-for/5-replace-for-while/task.md | 6 ++--- .../6-repeat-until-correct/solution.md | 10 ++++----- .../6-repeat-until-correct/task.md | 8 +++---- .../13-while-for/7-list-primes/solution.md | 10 ++++----- .../13-while-for/7-list-primes/task.md | 14 ++++++------ 12 files changed, 56 insertions(+), 56 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md b/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md index 495359876..204650e64 100644 --- a/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md +++ b/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md @@ -1,30 +1,30 @@ -The task demonstrates how postfix/prefix forms can lead to different results when used in comparisons. +Այս առաջադրանքը ցուց է տալիս, թե ինչպես նախածանցի/վերջածանցի կիրառումը կարող է բերել տարբեր արդյունքների, երբ դրանք օգտագործվում են համեմատության մեջ։ -1. **From 1 to 4** +1. **1֊ից մինչև 4** ```js run let i = 0; while (++i < 5) alert( i ); ``` - The first value is `i = 1`, because `++i` first increments `i` and then returns the new value. So the first comparison is `1 < 5` and the `alert` shows `1`. + Առաջին արժեքը `i = 1`, քանի որ `++i`֊ն սկզբում աճեցնում է `i`֊ի արժեքը, և հետո նոր վերադարձնում ստացված նոր աժեքը։ Այսպիսով առաջին համեմատությունը կլինի `1 < 5` և `alert`֊ը ցույց կտա `1`։ - Then follow `2, 3, 4…` -- the values show up one after another. The comparison always uses the incremented value, because `++` is before the variable. + Ապա կհաջորդի `2, 3, 4…` -- արժեքները կցուցադրվեն մեկը մյուսի հետևից։ Համեմատումը միշտ օգտագործում է ավելացված արժեքը, քանի որ `++`֊ը գրված է փոփոխականից առաջ։ - Finally, `i = 4` is incremented to `5`, the comparison `while(5 < 5)` fails, and the loop stops. So `5` is not shown. -2. **From 1 to 5** + Եվ վերջապես `i = 4` ավելացվում է դառնալով `5`, `while(5 < 5)` համեմատումը կլինի սխալ, և ցիկլը կավարտվի։ Այսպիսով `5`֊ը չի երևա էկրանին։ +2. **1֊ից մինչև 5** ```js run let i = 0; while (i++ < 5) alert( i ); ``` - The first value is again `i = 1`. The postfix form of `i++` increments `i` and then returns the *old* value, so the comparison `i++ < 5` will use `i = 0` (contrary to `++i < 5`). + Առաջին արժեքը կրկին `i = 1`։ `i++`֊ը աճեցնում է `i`֊ն, և ապա վերադարձնում *հին* արժեքը, այսպիսով `i++ < 5` համեմատության մեջ `i = 0` (ի տարբերություն `++i < 5`֊ի)։ - But the `alert` call is separate. It's another statement which executes after the increment and the comparison. So it gets the current `i = 1`. + Բայց `alert`֊ի կանչը առանձին է։ Այն առանձին հատված է, որը կատարվում է փոփոխականի աճից և համեմատումից հետո։ Այսպիսով այն ստանում է ընթացիկ `i = 1`։ - Then follow `2, 3, 4…` + Ապա հետևում են `2, 3, 4…`։ - Let's stop on `i = 4`. The prefix form `++i` would increment it and use `5` in the comparison. But here we have the postfix form `i++`. So it increments `i` to `5`, but returns the old value. Hence the comparison is actually `while(4 < 5)` -- true, and the control goes on to `alert`. + Կանգ առնենք `i = 4` դեպքի վրա։ `++i`֊ն կաճեցներ `i`֊ն և կօգտագործեր `5` արժեքը համեմատման համար։ Բայց այստեղ օգտագործվում է `i++`, որը աճեցնում է `i`֊ն՝ դանձնելով `5`, և վերադարձնում հին արժեքը։ Հետևաբար համեմատումը կլինի `while(4 < 5)` -- որն էլ ճիշտ է, և `alert`֊ը ցույց կտա `5` արժեքը։ - The value `i = 5` is the last one, because on the next step `while(5 < 5)` is false. + `i = 5` արժեքի դեպքում հաջորդ քայլում կունենանք `while(5 < 5)`, որն էլ սխալ է։ diff --git a/1-js/02-first-steps/13-while-for/2-which-value-while/task.md b/1-js/02-first-steps/13-while-for/2-which-value-while/task.md index 298213237..21374d7fa 100644 --- a/1-js/02-first-steps/13-while-for/2-which-value-while/task.md +++ b/1-js/02-first-steps/13-while-for/2-which-value-while/task.md @@ -2,19 +2,19 @@ importance: 4 --- -# Which values does the while loop show? +# Ինչպիսի՞ արժեքներ ցույց կտա while ցիկլը -For every loop iteration, write down which value it outputs and then compare it with the solution. +Ամեն իտերացիայի համար գրառեք, թե ինչպիսի արժեքներ ցույց կտա ցիկլը, և համեմատեք ձեր պատասխանները լուծման հետ։ -Both loops `alert` the same values, or not? +Արդյո՞ք երկու ցիկլերն էլ ցույց `alert` կանեն նույն արժեքները, թե ոչ։ -1. The prefix form `++i`: +1. `++i` նախածանցով (prefix). ```js let i = 0; while (++i < 5) alert( i ); ``` -2. The postfix form `i++` +2. `i++` վերջածանցով (postfix). ```js let i = 0; diff --git a/1-js/02-first-steps/13-while-for/3-which-value-for/solution.md b/1-js/02-first-steps/13-while-for/3-which-value-for/solution.md index e2e28e75b..7bc9ef467 100644 --- a/1-js/02-first-steps/13-while-for/3-which-value-for/solution.md +++ b/1-js/02-first-steps/13-while-for/3-which-value-for/solution.md @@ -1,4 +1,4 @@ -**The answer: from `0` to `4` in both cases.** +**Պատասխան՝ `0`֊ից մինչև `4`, երկու դեպքում էլ։** ```js run for (let i = 0; i < 5; ++i) alert( i ); @@ -6,12 +6,12 @@ for (let i = 0; i < 5; ++i) alert( i ); for (let i = 0; i < 5; i++) alert( i ); ``` -That can be easily deducted from the algorithm of `for`: +Այս պատասխանին կարող ենք հասնել դիտարկելով `for`֊ի աշխատելու ալգորիթմը․ -1. Execute once `i = 0` before everything (begin). -2. Check the condition `i < 5` -3. If `true` -- execute the loop body `alert(i)`, and then `i++` +1. Կատարում է մի անգամ `i = 0`, ամեն ինչից առաջ (սկիզբ)։ +2. Ստուգում է պայմանը `i < 5`։ +3. Եթե ճիշտ է (`true`) -- կատարում է ցիկլի մարմինը՝ `alert(i)`, և ապա `i++` -The increment `i++` is separated from the condition check (2). That's just another statement. +`i++` աճը բաժանված է պայմանի ստուգման գործողությունից (2)։ Այն կոդի ուրիշ անկախ հատված է։ -The value returned by the increment is not used here, so there's no difference between `i++` and `++i`. +Աճեցումից հետո վերադարձված արժեքը այստեղ չի օգտագործվում, այսպիսով տարբերություն չկա `i++`֊ի և `++i`֊ի միջև։ diff --git a/1-js/02-first-steps/13-while-for/3-which-value-for/task.md b/1-js/02-first-steps/13-while-for/3-which-value-for/task.md index bfefa63f5..4b00882b9 100644 --- a/1-js/02-first-steps/13-while-for/3-which-value-for/task.md +++ b/1-js/02-first-steps/13-while-for/3-which-value-for/task.md @@ -2,18 +2,18 @@ importance: 4 --- -# Which values get shown by the "for" loop? +# Ո՞ր արժեքները կցուցադրվեն "for" ցիկլի միջոցով -For each loop write down which values it is going to show. Then compare with the answer. +Ամեն ցիկլի համար գրառեք, թե ինչպիսի արժեքներ ցույց կտա ցիկլը, և համեմատեք ձեր պատասխանները լուծման հետ։ -Both loops `alert` same values or not? +Արդյո՞ք երկու ցիկլերն էլ ցույց `alert` կանեն նույն արժեքները, թե ոչ։ -1. The postfix form: +1. Վերջածանցով (postfix). ```js for (let i = 0; i < 5; i++) alert( i ); ``` -2. The prefix form: +2. Նախածանցով (prefix). ```js for (let i = 0; i < 5; ++i) alert( i ); diff --git a/1-js/02-first-steps/13-while-for/4-for-even/solution.md b/1-js/02-first-steps/13-while-for/4-for-even/solution.md index e8e66bb47..c3c9d199c 100644 --- a/1-js/02-first-steps/13-while-for/4-for-even/solution.md +++ b/1-js/02-first-steps/13-while-for/4-for-even/solution.md @@ -8,4 +8,4 @@ for (let i = 2; i <= 10; i++) { } ``` -We use the "modulo" operator `%` to get the remainder and check for the evenness here. +Մենք օգտագործում ենք "մնացորդի" օպերատոր `%`֊ը մնացորդը ստանալու համար, և ստուգում ենք թվի զույգությունը։ diff --git a/1-js/02-first-steps/13-while-for/4-for-even/task.md b/1-js/02-first-steps/13-while-for/4-for-even/task.md index ff34e7e40..b4d8bfa20 100644 --- a/1-js/02-first-steps/13-while-for/4-for-even/task.md +++ b/1-js/02-first-steps/13-while-for/4-for-even/task.md @@ -2,8 +2,8 @@ importance: 5 --- -# Output even numbers in the loop +# Ցուցադրել զույգ թվերը ցիկլի միջոցով -Use the `for` loop to output even numbers from `2` to `10`. +Օգտագործեք `for` ցիկլը ցուցադրելու զույգ թվերը `2`֊ից մինչև `10`։ [demo] diff --git a/1-js/02-first-steps/13-while-for/5-replace-for-while/solution.md b/1-js/02-first-steps/13-while-for/5-replace-for-while/solution.md index 612cf559c..1d918d3d0 100644 --- a/1-js/02-first-steps/13-while-for/5-replace-for-while/solution.md +++ b/1-js/02-first-steps/13-while-for/5-replace-for-while/solution.md @@ -3,7 +3,7 @@ ```js run let i = 0; while (i < 3) { - alert( `number ${i}!` ); + alert( `Համար ${i}!` ); i++; } ``` diff --git a/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md b/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md index 0c69d9c2d..8695a04ae 100644 --- a/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md +++ b/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md @@ -2,13 +2,13 @@ importance: 5 --- -# Replace "for" with "while" +# Փոխարինեք "for"֊ը "while"֊ով -Rewrite the code changing the `for` loop to `while` without altering its behavior (the output should stay same). +Վերաշարադրեք կոդը, փոխելով `for` ցիկլը `while`֊ով, առանց նրա կատարման արդյունքը փոխելու (ցուցադրվող արժեքները պետք է մնամ նույնը)։ ```js run for (let i = 0; i < 3; i++) { - alert( `number ${i}!` ); + alert( `Համար ${i}!` ); } ``` diff --git a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md index c7de5f09b..190fb6575 100644 --- a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md +++ b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md @@ -3,13 +3,13 @@ let num; do { - num = prompt("Enter a number greater than 100?", 0); + num = prompt("Ներմուծեք 100֊ից բարձր թիվ", 0); } while (num <= 100 && num); ``` -The loop `do..while` repeats while both checks are truthy: +`do..while` ցիկլը կրկնում է քանի դեռ երկու պայմաններն էլ ճշմարիտ չեն․ -1. The check for `num <= 100` -- that is, the entered value is still not greater than `100`. -2. The check `&& num` is false when `num` is `null` or an empty string. Then the `while` loop stops too. +1. `num <= 100` ստուգումը նշանակում է, որ ներմուծված թիվը դեռ մեծ չէ `100`֊ից։ +2. `&& num` ստուգումը սխալ է, երբ `num`֊ը `null` է կամ դատարկ տող։ Այդ դեպքում `while`֊ը կանգ է առնում։ -P.S. If `num` is `null` then `num <= 100` is `true`, so without the 2nd check the loop wouldn't stop if the user clicks CANCEL. Both checks are required. +Եթե `num`֊ը `null` է, ապա `num <= 100` համեմատումը `true` է, այսինքն առանց երկրորդ պայմանի ցիկլը կանգ չէր առնի, եթե օգտատերը սեղմեր ՉԵՂԱՐԿԵԼ (CANCEL): Երկու պայմանն էլ պարտադիր են։ diff --git a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/task.md b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/task.md index 0788ee76e..ca3b03c69 100644 --- a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/task.md +++ b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/task.md @@ -2,12 +2,12 @@ importance: 5 --- -# Repeat until the input is correct +# Կրկնել քանի դեռ ներմուծված արժեքը ճիշտ չէ -Write a loop which prompts for a number greater than `100`. If the visitor enters another number -- ask them to input again. +Գրել ցիկլ, որը կհարցնի (prompt) թիվ, որը պետք է լինի մեծ `100`֊ից։ Եթե օգտատերը ներմուծի ուրիշ թիվ (պայմանին չբավարարող) -- տալ նրան ներմուծել կրկին։ -The loop must ask for a number until either the visitor enters a number greater than `100` or cancels the input/enters an empty line. +Ցիկլը պետք է ուզի թիվ օգտատերից, մինչև մուտքագրվի `100`֊ից մեծ թիվ կամ չեղարկվի (cancel) ներմուծումը (մուտքագրվի դատարկ տող)։ -Here we can assume that the visitor only inputs numbers. There's no need to implement a special handling for a non-numeric input in this task. +Ենթադրվում է, որ օգտատերը ներմուծում է միայն թվային արժեքներ։ Լրացուցիչ դեպքեր պետք չէ դիտարկել ոչ թվային արժեքների համար։ [demo] diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md index b4b64b6fa..ee66a40ae 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md @@ -16,14 +16,14 @@ The code using a label: let n = 10; nextPrime: -for (let i = 2; i <= n; i++) { // for each i... +for (let i = 2; i <= n; i++) { // ամեն i֊ի համար... - for (let j = 2; j < i; j++) { // look for a divisor.. - if (i % j == 0) continue nextPrime; // not a prime, go next i + for (let j = 2; j < i; j++) { // փնտրում է բաժանարար.. + if (i % j == 0) continue nextPrime; // պերզ չէ, անցնում է հաջորդ i֊ին } - alert( i ); // a prime + alert( i ); // պարզ թիվ } ``` -There's a lot of space to optimize it. For instance, we could look for the divisors from `2` to square root of `i`. But anyway, if we want to be really efficient for large intervals, we need to change the approach and rely on advanced maths and complex algorithms like [Quadratic sieve](https://en.wikipedia.org/wiki/Quadratic_sieve), [General number field sieve](https://en.wikipedia.org/wiki/General_number_field_sieve) etc. +Այս օրինակում կան շատ տեղեր, որ կարելի է ավելի օպտիմալ գրել։ Օրինակ մենք կարող ենք փնտրել բաժանարարները `2`֊ից մինչև արմատ `i`֊ն։ Մեծ ինտերվալների դեպքում մենք պետք է լավացնենք (այսինքն փոքրացնենք) փնտրման սահմանները, ավելի արդյունավետ ծրագիր ստանալու համար։ Դրա համար պետք է ծանոթ լինենք խորացված մաթեմատիկայի տարրերին և կոմպլեքս ալգորիթմներին, ինչպիսիք են [Քառակուսային մաղ (Quadratic sieve)](https://en.wikipedia.org/wiki/Quadratic_sieve), [Ընդհանուր թվերի դաշտային մաղ (General number field sieve)](https://en.wikipedia.org/wiki/General_number_field_sieve) և այլն։ diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/task.md b/1-js/02-first-steps/13-while-for/7-list-primes/task.md index 6344b9f6f..055efade4 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/task.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/task.md @@ -2,16 +2,16 @@ importance: 3 --- -# Output prime numbers +# Տպել պարզ թվերը -An integer number greater than `1` is called a [prime](https://en.wikipedia.org/wiki/Prime_number) if it cannot be divided without a remainder by anything except `1` and itself. +`1`֊ից մեծ ամբողջ թիվը կոչվում է [պարզ](https://hy.wikipedia.org/wiki/Պարզ_թիվ), եթե ունի միայն երկու բաժանարար, դրանք են՝ `1`֊ը և հենց ինքը։ -In other words, `n > 1` is a prime if it can't be evenly divided by anything except `1` and `n`. +Այլ կերպ ասած, `n > 1` պայմանին բավարարող `n`֊ը պարզ է, եթե այն հնարավոր չէ անմնացորդ բաժանել կամայական ամբողջ թվի վրա, բացի `1`֊ից և `n`֊ից։ -For example, `5` is a prime, because it cannot be divided without a remainder by `2`, `3` and `4`. +Օրինակ, `5`֊ը պարզ է, քանի որ այն չի բաժանվում `2`֊ի, `3`֊ի և `4`֊ի։ -**Write the code which outputs prime numbers in the interval from `2` to `n`.** +**Գրել ծրագրի, որը կտպի բոլոր պարզ թվերը `2`֊ից մինչև `n` հատվածում.** -For `n = 10` the result will be `2,3,5,7`. +`n = 10` դեպքի համար արդյունքը պետք է լինի `2,3,5,7`։ -P.S. The code should work for any `n`, not be hard-tuned for any fixed value. +Հ․Գ․ Ծրագիրը պետք է աշխատի կամայական `n`֊ի համար, այսինքն `n`֊ը պետք է հեշտ մոդիֆիկացվի։ From 0ae628f4c38d7bae18f791b9e4cc3b13063497e5 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 17:37:35 +0400 Subject: [PATCH 06/30] Update 1-js/02-first-steps/13-while-for/article.md --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 359626362..645fd6504 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -309,7 +309,7 @@ for (let i = 0; i < 3; i++) { let input = prompt(`Արժեքը (${i},${j}) կոորդինատում`, ''); - // ինչ եթե ցանկանում ենք դուրս գալ այստեղից, և անցնել Պատրաստ է (ներքև) տողին? + // ի՞նչ եթե ցանկանում ենք դուրս գալ այստեղից, և անցնել Պատրաստ է (ներքև) տողին } } From feb54b2361d1d91575ff97e11319bcf0cdb888a0 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:08:55 +0400 Subject: [PATCH 07/30] Update 1-js/02-first-steps/13-while-for/2-which-value-while/solution.md Co-authored-by: Arsen Melikyan --- .../02-first-steps/13-while-for/2-which-value-while/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md b/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md index 204650e64..4e7016d58 100644 --- a/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md +++ b/1-js/02-first-steps/13-while-for/2-which-value-while/solution.md @@ -19,7 +19,7 @@ while (i++ < 5) alert( i ); ``` - Առաջին արժեքը կրկին `i = 1`։ `i++`֊ը աճեցնում է `i`֊ն, և ապա վերադարձնում *հին* արժեքը, այսպիսով `i++ < 5` համեմատության մեջ `i = 0` (ի տարբերություն `++i < 5`֊ի)։ + Առաջին արժեքը կրկին `i = 1` է։ `i++`֊ը աճեցնում է `i`֊ն, և ապա վերադարձնում *հին* արժեքը, այսպիսով `i++ < 5` համեմատության մեջ `i = 0` (ի տարբերություն `++i < 5`֊ի)։ Բայց `alert`֊ի կանչը առանձին է։ Այն առանձին հատված է, որը կատարվում է փոփոխականի աճից և համեմատումից հետո։ Այսպիսով այն ստանում է ընթացիկ `i = 1`։ From 3cc080869817e52d40249c931772f4bbbca73407 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:09:13 +0400 Subject: [PATCH 08/30] Update 1-js/02-first-steps/13-while-for/5-replace-for-while/task.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/5-replace-for-while/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md b/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md index 8695a04ae..924ca648d 100644 --- a/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md +++ b/1-js/02-first-steps/13-while-for/5-replace-for-while/task.md @@ -4,7 +4,7 @@ importance: 5 # Փոխարինեք "for"֊ը "while"֊ով -Վերաշարադրեք կոդը, փոխելով `for` ցիկլը `while`֊ով, առանց նրա կատարման արդյունքը փոխելու (ցուցադրվող արժեքները պետք է մնամ նույնը)։ +Վերաշարադրեք կոդը, փոխելով `for` ցիկլը `while`֊ով, առանց նրա կատարման արդյունքը փոխելու (ցուցադրվող արժեքները պետք է մնան նույնը)։ ```js run for (let i = 0; i < 3; i++) { From 998b0038fa60dd707adbf07b9c83cd893e3e7c1a Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:09:36 +0400 Subject: [PATCH 09/30] Update 1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md Co-authored-by: Arsen Melikyan --- .../13-while-for/6-repeat-until-correct/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md index 190fb6575..061e91102 100644 --- a/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md +++ b/1-js/02-first-steps/13-while-for/6-repeat-until-correct/solution.md @@ -7,7 +7,7 @@ do { } while (num <= 100 && num); ``` -`do..while` ցիկլը կրկնում է քանի դեռ երկու պայմաններն էլ ճշմարիտ չեն․ +`do..while` ցիկլը կրկնում է քանի դեռ երկու պայմաններն էլ ճշմարիտ են․ 1. `num <= 100` ստուգումը նշանակում է, որ ներմուծված թիվը դեռ մեծ չէ `100`֊ից։ 2. `&& num` ստուգումը սխալ է, երբ `num`֊ը `null` է կամ դատարկ տող։ Այդ դեպքում `while`֊ը կանգ է առնում։ From 763c6f2e7639ed1ccf6671862345bb1429c8894b Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:09:55 +0400 Subject: [PATCH 10/30] Update 1-js/02-first-steps/13-while-for/7-list-primes/solution.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/7-list-primes/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md index ee66a40ae..2f4a4f189 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md @@ -19,7 +19,7 @@ nextPrime: for (let i = 2; i <= n; i++) { // ամեն i֊ի համար... for (let j = 2; j < i; j++) { // փնտրում է բաժանարար.. - if (i % j == 0) continue nextPrime; // պերզ չէ, անցնում է հաջորդ i֊ին + if (i % j == 0) continue nextPrime; // պարզ չէ, անցնում է հաջորդ i֊ին } alert( i ); // պարզ թիվ From ffb0e128899523c5424218968271b77f4d60a502 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:11:36 +0400 Subject: [PATCH 11/30] Update 1-js/02-first-steps/13-while-for/7-list-primes/task.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/7-list-primes/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/task.md b/1-js/02-first-steps/13-while-for/7-list-primes/task.md index 055efade4..0c0c56b83 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/task.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/task.md @@ -10,7 +10,7 @@ importance: 3 Օրինակ, `5`֊ը պարզ է, քանի որ այն չի բաժանվում `2`֊ի, `3`֊ի և `4`֊ի։ -**Գրել ծրագրի, որը կտպի բոլոր պարզ թվերը `2`֊ից մինչև `n` հատվածում.** +**Գրել ծրագիր, որը կտպի բոլոր պարզ թվերը `2`֊ից մինչև `n` հատվածում:** `n = 10` դեպքի համար արդյունքը պետք է լինի `2,3,5,7`։ From 38730defcee83bb00219eb49cf276c98b2e2c07c Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 18:18:50 +0400 Subject: [PATCH 12/30] 7th sol fix --- .../13-while-for/7-list-primes/solution.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md index 2f4a4f189..b7c22ff7e 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md @@ -1,16 +1,16 @@ -There are many algorithms for this task. +Կան շատ տարբեր ալգորիթմներ այս խնդրիը լուծելու համար։ -Let's use a nested loop: +Եկեք օգտագործենք ներդրված ցիկլեր․ ```js -For each i in the interval { - check if i has a divisor from 1..i - if yes => the value is not a prime - if no => the value is a prime, show it +Բոլոր i֊երի համար հատվածից { + ստուգու է, արդյոք i֊ն բաժանվում է ինչ֊որ թվի միչև ինքը + եթե այո => արժեքը պարզ չէ + եթե ոչ => արժեքը պարզ է և պետք է ցույց տալ այն } ``` -The code using a label: +Ծրագիրը օգտագործում է պիտակ (label)․ ```js run let n = 10; From 5806f1396775a671b26b12ff68ad35384cee4e01 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:31:29 +0400 Subject: [PATCH 13/30] Update 1-js/02-first-steps/13-while-for/7-list-primes/solution.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/7-list-primes/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md index b7c22ff7e..73aae6486 100644 --- a/1-js/02-first-steps/13-while-for/7-list-primes/solution.md +++ b/1-js/02-first-steps/13-while-for/7-list-primes/solution.md @@ -4,7 +4,7 @@ ```js Բոլոր i֊երի համար հատվածից { - ստուգու է, արդյոք i֊ն բաժանվում է ինչ֊որ թվի միչև ինքը + ստուգում է, արդյոք i֊ն բաժանվում է ինչ֊որ թվի միչև ինքը եթե այո => արժեքը պարզ չէ եթե ոչ => արժեքը պարզ է և պետք է ցույց տալ այն } From e653e50b903bd15fff9c9ee00b835a4e84342f64 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:31:43 +0400 Subject: [PATCH 14/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 645fd6504..c5b3481d0 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -1,6 +1,6 @@ # Ցիկլեր․ while և for -Հաճախ մենք կարիք ենք ունենում կրկնել ինչ֊որ գործողությունների հետթականություն։ +Հաճախ մենք կարիք ենք ունենում կրկնել ինչ֊որ գործողությունների հերթականություն։ Օրինակ․ տպել իրար հետևից ցուցակի մեջ գտնվող ապրանքները, կամ ուղղակի աշխակատցնել նույն կոդը 1֊ից 10 բոլոր թվերի համար։ From 6f701c68342b31b52805a26ecd687c78f08110ae Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:32:06 +0400 Subject: [PATCH 15/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index c5b3481d0..8585d1654 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -2,7 +2,7 @@ Հաճախ մենք կարիք ենք ունենում կրկնել ինչ֊որ գործողությունների հերթականություն։ -Օրինակ․ տպել իրար հետևից ցուցակի մեջ գտնվող ապրանքները, կամ ուղղակի աշխակատցնել նույն կոդը 1֊ից 10 բոլոր թվերի համար։ +Օրինակ․ տպել իրար հետևից ցուցակի մեջ գտնվող ապրանքները, կամ ուղղակի աշխատեցնել նույն կոդը 1֊ից 10 բոլոր թվերի համար։ *Ցիկլերը* նույն կոդը մի քանի անգամ կրկնելու հնարավորություն են տալիս։ From df1e71f5f7f976df6f17000e1e03d7b54c0b4eb0 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:32:19 +0400 Subject: [PATCH 16/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 8585d1654..ad51ee222 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -68,7 +68,7 @@ do { } while (condition); ``` -Ցիկլը սկզբում կաշխատացնի մարմնը, ապա կստուգի պայմանը, և քանի դեռ այն ճշմարիտ է, այն կաշխատացնի մարմինը նորից ու նորից։ +Ցիկլը սկզբում կաշխատացնի մարմինը, ապա կստուգի պայմանը, և քանի դեռ այն ճշմարիտ է, այն կաշխատացնի մարմինը նորից ու նորից։ Օրինակ․ From 9f90054c55d960b79013df66ee81683f595bf65c Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:32:29 +0400 Subject: [PATCH 17/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index ad51ee222..f4a581d2c 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -84,7 +84,7 @@ do { ## "for" ցիկլը -`for` ցիլկը ավելի կոմպլեքս է, բայց այն ամենից շատ կիրառվող ցիկլն է։ +`for` ցիլկը ավելի բարդ է, բայց այն ամենից շատ կիրառվող ցիկլն է։ Այն ունի հետևյալ տեսքը․ From 14c423efd6249545ccb5664d0b546169cc286f32 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:32:44 +0400 Subject: [PATCH 18/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index f4a581d2c..bbd8bada8 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -94,7 +94,7 @@ for (begin; condition; step) { } ``` -Եկեք ուսումնասիրենք այդ մասեիը օրինակի վրա։ Ներքևի ցիկլը կատարում է `alert(i)` հրամանը `i`֊ն `0`֊ից մինչև `3`֊ը ոչ ներառյալ: +Եկեք ուսումնասիրենք այդ մասերը օրինակի վրա։ Ներքևի ցիկլը կատարում է `alert(i)` հրամանը `i`֊ն `0`֊ից մինչև `3`֊ը ոչ ներառյալ: ```js run for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 From 4ccbb8f45f726dd41424c0bb05287b8ae61b8fa3 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:33:03 +0400 Subject: [PATCH 19/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index bbd8bada8..618d82a72 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -368,7 +368,7 @@ break label; // ցատկ ներքևի պիտակին (չի աշխատի) label: for (...) ``` -`break` դիրեկտիվը պետք է լինի պիտակը պարունակող բլոկի ներսում։ Տեխնիկորեն կամայական պիտակավորված բլոկի համար կարող ենք անել հետևյալը․ +`break` դիրեկտիվը պետք է լինի պիտակը պարունակող բլոկի ներսում։ Տեխնիկապես կամայական պիտակավորված բլոկի համար կարող ենք անել հետևյալը․ ```js label: { // ... From 6482c5dbf241cc46e67e6786a150045ec6d6b87c Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:33:11 +0400 Subject: [PATCH 20/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 618d82a72..8338154be 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -349,7 +349,7 @@ alert('Պատրաստ է!'); Այդպիսով կատարում `(*)`֊ից գնում է միանգամից `alert('Done!')`։ -Մենք նաև կարոց ենք պիտակները տեղադրել ուրիշ տողում․ +Մենք նաև կարող ենք պիտակները տեղադրել ուրիշ տողում․ ```js no-beautify outer: From 3f2c9c8e2c4faa611ea54bc074a169075a1022bb Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:33:22 +0400 Subject: [PATCH 21/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 8338154be..02ac2be89 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -347,7 +347,7 @@ alert('Պատրաստ է!'); Վերևի ծրագրում `break outer`֊ը ման է գալիս իրեն ընդգրկող դրսի ցիկլ, որի պիտակը `outer` է, և կանգնեցնում այն։ -Այդպիսով կատարում `(*)`֊ից գնում է միանգամից `alert('Done!')`։ +Այդպիսով կատարումը `(*)`֊ից անցնում է միանգամից `alert('Done!')`։ Մենք նաև կարող ենք պիտակները տեղադրել ուրիշ տողում․ From 132ebde27daf932c196ba22b77bef23ef372d14a Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:33:38 +0400 Subject: [PATCH 22/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 02ac2be89..0ae3ef119 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -345,7 +345,7 @@ labelName: for (...) { alert('Պատրաստ է!'); ``` -Վերևի ծրագրում `break outer`֊ը ման է գալիս իրեն ընդգրկող դրսի ցիկլ, որի պիտակը `outer` է, և կանգնեցնում այն։ +Վերևի ծրագրում `break outer`֊ը փնտրում է իրեն ընդգրկող դրսի ցիկլը, որի պիտակը `outer` է, և կանգնեցնում այն։ Այդպիսով կատարումը `(*)`֊ից անցնում է միանգամից `alert('Done!')`։ From 8cef7f284b49ffa3341e717518941f01d2b2b61b Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:33:46 +0400 Subject: [PATCH 23/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 0ae3ef119..beb1c5d9d 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -318,7 +318,7 @@ alert('Պատրաստ է!'); Մեզ պետք է ինչ֊որ ձև կանգնեցնել պրոցեսը, եթե օգտատերը չեղարկել է ներմուծման դաշտը։ -Ստանդարտ `break`֊ը `input`֊ից հետօ կկանգնեցնի միայն ներսի ցիկլը։ Դա բավարար չէ, և այստեղ է, որ պիտակները գալիս են օգնության։ +Ստանդարտ `break`֊ը `input`֊ից հետո կկանգնեցնի միայն ներսի ցիկլը։ Դա բավարար չէ, և այստեղ է, որ պիտակները գալիս են օգնության։ *Պիտակը* դա նույնականացուցիչ (identifier) է վերջակետով ցիկլից առաջ․ ```js From 4927262d366bd052be21df10da3a85a6202bc163 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:34:04 +0400 Subject: [PATCH 24/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index beb1c5d9d..9f77bf476 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -102,7 +102,7 @@ for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 } ``` -Դիտարկենք `for`֊ը մաս֊առ֊մաս․ +Դիտարկենք `for`֊ը մաս առ մաս․ | մաս | | | |-------|----------|----------------------------------------------------------------------------| From a84d5d3066af1a46d80ec03713e94853189517b6 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:34:25 +0400 Subject: [PATCH 25/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 9f77bf476..290b84730 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -109,7 +109,7 @@ for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 | սկիզբ | `i = 0` | Կատարվում է, երբ մտնում ենք ցիկլ։ | | պայման | `i < 3`| Ստուգվում է ցիկլի ամեն իտերացիայից առաջ։ Եթե այն սխալ է, ապա ցիկլը կանգնեցվում է։ | | մարմին | `alert(i)`| Աշխատում է այնքան ժամանակ, քանի դեռ պայմանը ճշմարիտ է։ | -| քայլ| `i++` | Կատարվում է մարմնի կատարումից հետո, ամեն իտերացիայից ժամանակ։ | +| քայլ| `i++` | Կատարվում է մարմնի կատարումից հետո, ամեն իտերացիայի ժամանակ։ | Ընդհանուր դեպքում ալգորիթմը աշխատում է հետևյալ կերպ․ From 74574c738b57bdc5df7c80977fce5862d2147774 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:35:09 +0400 Subject: [PATCH 26/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 290b84730..7514bb174 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -272,7 +272,7 @@ for (let i = 0; i < 10; i++) { ```` ````warn header="Ոչ մի `break/continue` '?'֊ի աջ կողմում" -Ուշադրություն դարձրեք, որ սինտաքսիկ կոնդտրուկցիաները (syntax constructs) չեն հանդիիսանում արտահայտություններ (expressions) և չեն կարող օգտագործվել `?` օպերատորի հետ։ Մասնավոր դեպքում, դիրեկտիվները ինչպիսիք են `break/continue` թույլատրված չեն '?'֊ի հետ։ +Ուշադրություն դարձրեք, որ սինտաքսիկ կոնդտրուկցիաները (syntax constructs) չեն հանդիսանում արտահայտություններ (expressions) և չեն կարող օգտագործվել `?` օպերատորի հետ։ Մասնավոր դեպքում, `break/continue` և նմանատիպ դիրեկտիվները թույլատրված չեն '?'֊ի հետ։ Օրինակի համար, եթե դիտարկենք այս ծրագիրը․ From a76316ca2746bbdb0cc1f7a9dc90a1e6bde4018c Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:35:24 +0400 Subject: [PATCH 27/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 7514bb174..c3d71f741 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -121,7 +121,7 @@ for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 → ... ``` -Այսինքն, `սկիզբ`֊ը կատարվում է մեկ անգամ, և հետո սկսվում են իտերացիաները․ ամեն `պայման`֊ի ստուգումից հետո, `մարմին`֊ը և `քայլ`֊ը կատարվում են։ +Այսինքն՝ `սկիզբ`֊ը կատարվում է մեկ անգամ, և հետո սկսվում են իտերացիաները․ ամեն `պայման`֊ի ստուգումից հետո, `մարմին`֊ը և `քայլ`֊ը կատարվում են։ Եթե ցիկլերի թեման նոր է ձեր համար, ապա օգտակար կլինի հետ գնալ օրինակներին և քայլ֊առ֊քայլ գրառել դրանց կատարման ընթացքները թղթի վրա։ From b032a1f88a8f9eca6bfe7cb29484bd12807d7489 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:35:54 +0400 Subject: [PATCH 28/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index c3d71f741..d8a961513 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -123,7 +123,7 @@ for (let i = 0; i < 3; i++) { // ցույց կտա 0, հետո 1, հետո 2 Այսինքն՝ `սկիզբ`֊ը կատարվում է մեկ անգամ, և հետո սկսվում են իտերացիաները․ ամեն `պայման`֊ի ստուգումից հետո, `մարմին`֊ը և `քայլ`֊ը կատարվում են։ -Եթե ցիկլերի թեման նոր է ձեր համար, ապա օգտակար կլինի հետ գնալ օրինակներին և քայլ֊առ֊քայլ գրառել դրանց կատարման ընթացքները թղթի վրա։ +Եթե ցիկլերի թեման նոր է ձեր համար, ապա օգտակար կլինի հետ գնալ օրինակներին և քայլ առ քայլ գրառել դրանց կատարման ընթացքները թղթի վրա։ Ահա թե ինչ է տեղի ունենում կոնկրետ մեր օրինակի դեպքում․ From 6ba30b14aa376b6c1b7123a2fec39c61c96bc58d Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:36:10 +0400 Subject: [PATCH 29/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index d8a961513..7aa52deee 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -210,7 +210,7 @@ for (;;) { Բայց մենք կարող ենք հարկադրաբար (force) դուրս գալ ցիկլից, ամեն պահի, օգտագործելով հատուկ դիրեկտիվ `break`֊ը։ -Օրինակ ներքևի ցիկլը օգտատիրոջից անընդհատ թվային մուտք է ուզում, "ընդհատվում" է, երբ ոչ թվային արժեք է մուտքագրվում․ +Օրինակ՝ ներքևի ցիկլը օգտատիրոջից անընդհատ թվային մուտք է ուզում, "ընդհատվում" է, երբ ոչ թվային արժեք է մուտքագրվում․ ```js run let sum = 0; From 2de07d146f4007b1da37f37e913a386408339237 Mon Sep 17 00:00:00 2001 From: Vahagn Melkonyan Date: Sat, 21 Aug 2021 19:36:28 +0400 Subject: [PATCH 30/30] Update 1-js/02-first-steps/13-while-for/article.md Co-authored-by: Arsen Melikyan --- 1-js/02-first-steps/13-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index 7aa52deee..20a75efca 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -239,7 +239,7 @@ alert( 'Գումարը՝ ' + sum ); Մենք կարող ենք օգտագործել այն, եթե այլևս կարիք չկա շարունակել այդ պահի իտերացիան և ցանկանում ենք անցնել հաջորդին։ -Ներքև ցիկլը օգտագործում է `continue`֊ն ցուցադրելու միայն կենտ արժեքները․ +Ներքևի ցիկլը օգտագործում է `continue`֊ն՝ ցուցադրելու միայն կենտ արժեքները․ ```js run no-beautify for (let i = 0; i < 10; i++) {