General FizzBuzz: Difference between revisions

Content deleted Content added
→‎{{header|Lua}}: Changed to reflect changes in the original (Python) version.
→‎{{header|Lua}}: Removed default values, added output.
Line 1,166:
'''One of the few solutions which do not use expensive modulo ''(think about the CPU!)''.'''
{{trans|Python}}
<lang Lua>local n_deffunction =fizzbuzz(n, 8mods)
local mods_def = {
3, 'cheese ',
2, 'borccoli ',
3, 'sauce ',
}
 
local function fizzbuzz(n, mods)
n = n or n_def
mods = #mods ~= 0 and mods or mods_def
 
local res = {}
 
Line 1,212 ⟶ 1,202:
end
</lang>
 
{{out}}
<pre>
> mods = {
>> 3, 'cheese ',
>> 2, 'borccolibroccoli ',
>> 3, 'sauce ',
>> }
local function> fizzbuzz(n8, mods)
1
broccoli
cheese sauce
broccoli
5
cheese broccoli sauce
7
broccoli </pre>
 
=={{header|Nim}}==