Skip to content

Loops: while and for #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Mar 30, 2021
Merged

Loops: while and for #103

merged 24 commits into from
Mar 30, 2021

Conversation

mahdiHash
Copy link
Contributor

Please read the description of task 7 "list primes"
Translation of "article.md" was a little tricky and some parts of translation may be weird so please review and comment / commit if you have anything better in mind

line 11: `i++` -> `++i`  because it is `پیشوند`

line 18: `++i` -> `i++`  because it is `پسوند`
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
Please review and comment / commit if anything is wrong
I'm not sure of line 17 translation.
Please review and comment / commit if it could be better or anything is wrong
Changed `می شود` to `شده` for reading purposes.
The translation was a little tricky so please review and comment / commit if anything is wrong.
Changed "میشود" to "می شود"
Changed "میشود" to "می شود"
}
```

While the `condition` is truthy, the `code` from the loop body is executed.
تا وقتی که `condition` برابر با truthy باشد، `کد` قسمت بدنه حلقه اجرا می شود.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

برابر با is not needed.


For instance, the loop below outputs `i` while `i < 3`:
برای مثال، حلقه پایین `i` را نمایش می دهد تا وقتی که `i < 3`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Persian verb comes at the end, so It would be a better translation:
برای مثال، حلقه پایین `i` را تا وقتی که `i < 3` باشد، نمایش می‌دهد:

}
```

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` (اما شامل نمی شود) اجرا می کند:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(خود ۳ شامل نمی‌شود)

alert(i);
}
```

Let's examine the `for` statement part-by-part:
بیایید دستور `for` را قسمت به قسمت بازرسی کنیم:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Statement" doesn't mean دستور, using شرح would be a better idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also using 'بررسی' instead of 'بازرسی' would be a better idea.


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.
اگر شما در حلقه ها تازه وارد هستید، این می تواند کمک کند که به مثال برگردید و چگونگی اجرا شدن آن را مرحله به مرحله روی یک کاغذ بنویسید.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't translate literally, see what would look more natural in Persian, even if it's not the same words in English:
اگر تازه با حلقه‌ها آشنا شده اید، به مثال برگردید و بر روی یک تکه کاغذ مراحل اجرای آن را قدم به قدم بازتولید کنید.‍‍

@@ -192,32 +192,32 @@ for (; i < 3;) {
}
```

This makes the loop identical to `while (i < 3)`.
این کار حلقه را شبیه `while (i < 3)` می کند.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

همسان/برابر با

}
```

Please note that the two `for` semicolons `;` must be present. Otherwise, there would be a syntax error.
لطفا در نظر داشته باشید که هر دو نقطه ویرگول `;` داخل `for` باید وجود داشته باشند. در غیر این صورت، یک ارور سینتکس به وجود خواهد آمد.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

سینتکس ارور


## Breaking the loop
## شکستن حلقه
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

متوقف‌کردن حلقه


For example, the loop below asks the user for a series of numbers, "breaking" when no number is entered:
برای مثال، حلقه زیر از کاربر یک سری عدد درخواست می کند، و زمانی که هیچ عددی وارد نشد "می شکند":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

متوقف می‌شود

```

...it stops working: there's a syntax error.
...متوقف می شود: چون یک ارور سینتکس وجود دارد.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

سینتکس ارور

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

All the mentioned problems are fixed and I also changed some lines to make it more readable
@mahdiHash
Copy link
Contributor Author

Thank you @mahdyar for your review

@mahdiHash
Copy link
Contributor Author

/done

@mahdyar mahdyar merged commit daf19aa into javascript-tutorial:master Mar 30, 2021
@javascript-translate-bot

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants