-
Notifications
You must be signed in to change notification settings - Fork 98
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
Loops: while and for #103
Conversation
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
Update my forked repo
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 باشد، `کد` قسمت بدنه حلقه اجرا می شود. |
There was a problem hiding this comment.
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`: |
There was a problem hiding this comment.
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` (اما شامل نمی شود) اجرا می کند: |
There was a problem hiding this comment.
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` را قسمت به قسمت بازرسی کنیم: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. | ||
اگر شما در حلقه ها تازه وارد هستید، این می تواند کمک کند که به مثال برگردید و چگونگی اجرا شدن آن را مرحله به مرحله روی یک کاغذ بنویسید. |
There was a problem hiding this comment.
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)` می کند. |
There was a problem hiding this comment.
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` باید وجود داشته باشند. در غیر این صورت، یک ارور سینتکس به وجود خواهد آمد. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
سینتکس ارور
|
||
## Breaking the loop | ||
## شکستن حلقه |
There was a problem hiding this comment.
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: | ||
برای مثال، حلقه زیر از کاربر یک سری عدد درخواست می کند، و زمانی که هیچ عددی وارد نشد "می شکند": |
There was a problem hiding this comment.
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. | ||
...متوقف می شود: چون یک ارور سینتکس وجود دارد. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
سینتکس ارور
Please make the requested changes. After it, add a comment "/done". |
All the mentioned problems are fixed and I also changed some lines to make it more readable
Thank you @mahdyar for your review |
/done |
Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉 |
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