Skip to content

Instantly share code, notes, and snippets.

@richthegeek
Created March 6, 2012 10:03
Show Gist options
  • Save richthegeek/1985434 to your computer and use it in GitHub Desktop.
Save richthegeek/1985434 to your computer and use it in GitHub Desktop.
Fizzbuzz in SCSS
@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