17 lines
466 B
Text
17 lines
466 B
Text
with javascript_semantics
|
|
|
|
procedure general_fizz_buzz(integer lim, sequence words, facts)
|
|
for i=1 to lim do
|
|
string word = ""
|
|
for j, f in facts do
|
|
if remainder(i,f)=0 then
|
|
word &= words[j]
|
|
end if
|
|
end for
|
|
if length(word)=0 then
|
|
word = sprintf("%d",i)
|
|
end if
|
|
printf(1,"%s\n",{word})
|
|
end for
|
|
end procedure
|
|
general_fizz_buzz(20, {"Fizz","Buzz","Baxx"}, {3,5,7})
|