From c9a4c901d452ba4ab6f7654c629903aa24f78ece Mon Sep 17 00:00:00 2001 From: Sidak Singh Aulakh Date: Wed, 13 Feb 2019 03:02:07 +0530 Subject: [PATCH] Added Solution in Guide to while sass problem (#35172) * Guide: added solution @while sass Added proper Solution to the Guide for the problem Apply a Style Until a Condition is Met with @while, this is no longer a stub * fix: used 2-space indentation and removed verbiage * Removed images with broken links * Added back the images previously removed. --- .../index.md | 62 ++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/guide/english/certifications/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/index.md b/guide/english/certifications/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/index.md index bcbf1adee49..2d3075885fc 100644 --- a/guide/english/certifications/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/index.md +++ b/guide/english/certifications/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/index.md @@ -1,10 +1,68 @@ --- title: Apply a Style Until a Condition is Met with @while --- + ## Apply a Style Until a Condition is Met with @while -This is a stub. Help our community expand it. +![](//discourse-user-assets.s3.amazonaws.com/original/2X/3/3c8584a085a0deaea66b3400e6321eeadab552a2.jpg) -This quick style guide will help ensure your pull request gets accepted. +![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") + +### Problem Explanation: + +This program is very simple, the trick is to remember how while looping works. + +## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 0 + +* **Make sure your zoom settings are at `100%` or `default` otherwise tests sometimes fail. ** + +## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 + +* You will initialise the loop first with x as: `$x: 1` + +> _try to solve the problem now_ + +## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 + +* See the example for `@while` syntax, `@while $x < 11` + +> _try to solve the problem now_ + +## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 + +* to set class properties inside a loop we reference them enclosed by #{}, hence ere it will become: `.text-#{$x}` + +> _try to solve the problem now_ + +## Spoiler Alert! + +![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) + +**Solution ahead!** + +## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: + + +```css +$x: 1; +@while $x < 11 { + .text-#{$x} { + font-size: 5px * $x; + } + $x: $x + 1; +} +``` + +#### Relevant Links + +* Interpolation +* Variables +* while loops + +## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: + +* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. +* Add an explanation of your solution. +* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:")