Created
April 17, 2012 03:06
-
-
Save colindecarlo/2403109 to your computer and use it in GitHub Desktop.
FizzBuzz in twig
This file contains hidden or 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
{# I was reading the twig docs this evening and decided to give good ole fizzbuzz a try #} | |
{% for i in range(1,100) %} | |
<div> | |
{% if i is divisibleby(15) %} | |
Fizzbuzz | |
{% elseif i is divisibleby(3) %} | |
Fizz | |
{% elseif i is divisibleby(5) %} | |
Buzz | |
{% else %} | |
{{ i }} | |
{% endif %} | |
</div> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment