FizzBuzz: Difference between revisions
→{{header|Common Lisp}}
(→{{header|APL}}: Add more compact solution) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 539:
∊ Combine the selected elements into one vector/string
⎕← And print it out.</pre>
=={{header|AppleScript}}==
Line 2,781:
(fizzbuzz 100)</syntaxhighlight>
Solution 8:
<syntaxhighlight lang="lisp">(defun range (min max)
(loop
:for x :from min :to max
:collect x))
(defun fizzbuzz ()
(map 'nil #'(lambda (n)
(princ
(cond
((zerop (mod n 15)) "FizzBuzz!")
((zerop (mod n 5)) "Buzz!")
((zerop (mod n 3)) "Fizz!")
(t n))
(terpri)))
(range 1 100)))</syntaxhighlight>
First 16 lines of output:
<pre>
Line 9,838 ⟶ 9,856:
Whisper my world
=={{header|RPG}}==
<nowiki>**</nowiki>free
dcl-s ix Int(5);
for ix = 1 to 100;
select;
when %rem(ix:15) = 0;
dsply 'FizzBuzz';
when %rem(ix:5) = 0;
dsply 'Buzz';
when %rem(ix:3) = 0;
dsply 'Fizz';
other;
dsply (%char(ix));
endsl;
endfor;
=={{header|RPL}}==
|