Monday | 29 APR 2024
[ previous ]
[ next ]

FizzBuzz in my Templating Language

Title:
Date: 2023-06-20

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