I had a go at implementing the FizzBuzz task. Although a trivial conversion 
that tests for and outputs three different strings (a popular solution across 
the languages) I was hoping to do something clever that could

test for 3 and output Fizz
test for 5 and output Buzz
if either or both execute, naturally bypass printing the number

but everything I tried was messy, nerdy or incorrect.

procedure main()
    every i := 1 to 100 do
        write("" ~== (if i % 3 = 0 then "Fizz" else "") || (if i % 5 == 0 then 
"Buzz" else "") | i)
end

This works, but smacks of excessive cleverness rather than good coding.

Thoughts?




------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to