Files
Sidak Singh Aulakh c9a4c901d4 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.
2019-02-12 13:32:07 -08:00

3.3 KiB

title
title
Apply a Style Until a Condition is Met with @while

Apply a Style Until a Condition is Met with @while

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

Problem Explanation:

This program is very simple, the trick is to remember how while looping works.

:speech_balloon: Hint: 0

  • **Make sure your zoom settings are at 100% or default otherwise tests sometimes fail. **

:speech_balloon: Hint: 1

  • You will initialise the loop first with x as: $x: 1

try to solve the problem now

:speech_balloon: Hint: 2

  • See the example for @while syntax, @while $x < 11

try to solve the problem now

: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

Solution ahead!

:beginner: Basic Code Solution:

$x: 1;
@while $x < 11 {
  .text-#{$x} { 
    font-size: 5px * $x;
  }
  $x: $x + 1;
}

:clipboard: NOTES FOR CONTRIBUTIONS:

  • :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: