Created
March 6, 2012 10:03
-
-
Save richthegeek/1985434 to your computer and use it in GitHub Desktop.
Fizzbuzz in SCSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function mod($l, $r) { | |
@while ($l - $r) >= 0 { | |
$l: $l - $r; | |
} | |
@return abs($l); | |
} | |
@for $i from 1 through 100 { | |
#{$i} { | |
@if mod($i, 3) == 0 and mod($i, 5) == 0 { | |
#{$i}: fizzbuzz; | |
} | |
@else if mod($i, 3) == 0 { | |
#{$i}: fizz; | |
} | |
@else if mod($i, 5) == 0 { | |
#{$i}: buzz; | |
} | |
@else { | |
#{$i}: $i | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment