@while
هو خيار له وظيفة مشابهة لجافا سكريبت while
التكرار. يقوم بإنشاء قواعد CSS حتى يتم استيفاء الشرط. قدم تحدي @for
مثالاً لإنشاء نظام شبكة بسيط. هذا يمكن أن تعمل أيضا مع @while
. $ x: 1؛أولاً ، قم بتعريف متغير
while $ x <13 {
.col - # {$ x} {width: 100٪ / 12 * $ x؛}
$ x: $ x + 1؛
}
$x
وقم بتعيينه على 1. التالي ، استخدم التوجيه @while
لإنشاء نظام الشبكة بينما يكون $x
أقل من 13. بعد تعيين قاعدة CSS width
، يتم زيادة $x
بمقدار 1 لتجنب حلقة لا نهائية. @while
لإنشاء سلسلة من الفصول font-sizes
مختلفة من font-sizes
. يجب أن يكون هناك 10 فصول مختلفة من text-1
إلى text-10
. ثم قم بتعيين font-size
إلى 5 بكسل مضروبًا في رقم الفهرس الحالي. تأكد من تجنب حلقة لا نهائية! @while
توجيه @while
في الوقت @while
.
testString: 'assert(code.match(/@while /g), "Your code should use the @while
directive.");'
- text: يجب أن تحدد التعليمات البرمجية متغير فهرس إلى 1 لبدء.
testString: 'assert(code.match(/\$.*:\s*?1;/gi), "Your code should set an index variable to 1 to start.");'
- text: يجب أن تزيد التعليمات البرمجية الخاصة بك متغير عداد.
testString: 'assert(code.match(/\$(.*):\s*?\$\1\s*?\+\s*?1;/gi), "Your code should increment the counter variable.");'
- text: يجب أن يكون للفئة .text-1
font-size
يبلغ 5 بكسل.
testString: 'assert($(".text-1").css("font-size") == "5px", "Your .text-1
class should have a font-size
of 5px.");'
- text: يجب أن يكون لفئة .text-2
font-size
بيكسل.
testString: 'assert($(".text-2").css("font-size") == "10px", "Your .text-2
class should have a font-size
of 10px.");'
- text: يجب أن يكون للفئة .text-3
font-size
يبلغ 15 بكسل.
testString: 'assert($(".text-3").css("font-size") == "15px", "Your .text-3
class should have a font-size
of 15px.");'
- text: يجب أن يكون لفئة .text-4
font-size
بكسل.
testString: 'assert($(".text-4").css("font-size") == "20px", "Your .text-4
class should have a font-size
of 20px.");'
- text: يجب أن يكون لفئة .text .text-5
حجمًا font-size
25 بكسل.
testString: 'assert($(".text-5").css("font-size") == "25px", "Your .text-5
class should have a font-size
of 25px.");'
- text: ''
testString: 'assert($(".text-6").css("font-size") == "30px", "Your .text-6
class should have a font-size
of 30px.");'
- text: ''
testString: 'assert($(".text-7").css("font-size") == "35px", "Your .text-7
class should have a font-size
of 35px.");'
- text: ''
testString: 'assert($(".text-8").css("font-size") == "40px", "Your .text-8
class should have a font-size
of 40px.");'
- text: ''
testString: 'assert($(".text-9").css("font-size") == "45px", "Your .text-9
class should have a font-size
of 45px.");'
- text: ''
testString: 'assert($(".text-10").css("font-size") == "50px", "Your .text-10
class should have a font-size
of 50px.");'
```
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
```