:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

FizzBuzz in my Templating Language

2023-06-20
basic, template-language

I implemented FizzBuzz in my templating language and it's a half decent stressor. My blog is too simple so I only have looping. This tests the conditional logic.

{{ FOR I = 1 TO 15 }}
    {{ IF I % 3 = 0 AND I % 5 = 0 THEN }}
        FizzBuzz
    {{ END ELSE IF I % 3 = 0 THEN }}
        Fizz
    {{ END ELSE IF  I % 5 = 0 THEN }}
        Buzz
    {{ END ELSE }}
        {{ I }}
    {{ END }}
{{ NEXT I }}

This outputs:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz