Files
freeCodeCamp/guide/arabic/javascript/loops/while-loop/index.md
2018-10-16 21:32:40 +05:30

45 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: While Loop
localeTitle: حائط اللوب
---
تبدأ الحلقة أثناء تقييم الشرط. إذا كان الشرط صحيحًا ، فسيتم تنفيذ العبارة (القيم). إذا كان الشرط خاطئًا ، فلن يتم تنفيذ العبارة (القيم). بعد ذلك ، في حين ينتهي الحلقة.
في ما يلي **صيغة بناء الجملة** :
## بناء الجملة:
`while (condition)
{
statement(s);
}
`
_statement (s):_ بيان يتم تنفيذه طالما يتم تقييم الشرط إلى true.
_الحالة:_ هنا ، الشرط عبارة عن تعبير منطقي يتم تقييمه قبل كل مسار خلال الحلقة. إذا تم تقييم هذا الشرط إلى true ، فسيتم تنفيذ العبارة (الأكواد). عندما يتم تقييم الشرط إلى false ، يستمر التنفيذ مع العبارة بعد حلقة while.
## مثال:
` var i = 1;
while (i < 10)
{
console.log(i);
i++; // i=i+1 same thing
}
Output:
1
2
3
4
5
6
7
8
9
`
_المصدر: [While Loop - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while)_