FizzBuzz on Movable Type’s template

| No Comments | No TrackBacks

Now, it's a homework time, folks!

Two years ago, there was a boom of "FizzBuzz" among Japanese Movable Type users.

For exapmle,

*Problem

Print intergers 1 to 100, but replace multiple of 3 with "Fizz" and multiples of 5 with "Buzz" and multiples of both with "FizzBuzz".

You can use only MT's tag, and you can't use any other plugins.

Simple problem, isn't that?

Oscar, an author of "WolaWola", remembered this boom and made his own solution.

Okay, I will show you his answer after count 5.

1,

2,

3,

4,

5!

Here is an Oscar's answer.

<MTFor from="1" to="100">
<$MTSetVar name="word" value=""$>
   <MTIf name="__counter__" op="%" value="3" eq="0"> 
     <$MTSetVar name="word" value="Fizz"$>
   </MTIf>
   <MTIf name="__counter__" op="%" value="5" eq="0">
     <$MTSetVar name="word" value="Buzz" append="1"$> 
   </MTIf>
   <MTIf name="word" ne="">
     <MTGetVar name="word">
   <MTElse>
     <MTGetVar name="__counter__">
   </MTIf>
</MTFor>

and this is another answer using "_default" modifier.

<MTFor from="1" to="100">
  <$MTSetVar name="word" value=""$>
    <MTIf name="__counter__" op="%" value="3" eq="0">
      <$MTSetVar name="word" value="Fizz"$>
    </MTIf>
    <MTIf name="__counter__" op="%" value="5" eq="0">
      <$MTSetVar name="word" value="Buzz" append="1"$>
    </MTIf> <MTVar name="word" _default="$__counter__">
</MTFor>

How about your answer?

By the way, the boom of two years ago was provoked by Japanese comedian named "Nabeatsu".

I intoduce you his stand-up gag.

No TrackBacks

TrackBack URL: http://www.mt-j.info/mt/mt-tb.cgi/90

Leave a comment

About this Entry

This page contains a single entry by nick published on March 17, 2010 10:00 PM.

"RandomFeed" displays feed data to MT's dashboard was the previous entry in this blog.

“Gizmode Japanese edition” is published by Movbale Type is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.