June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,20 +1,7 @@
|
|||
REBOL [
|
||||
Title: "FizzBuzz"
|
||||
Author: oofoe
|
||||
Date: 2009-12-10
|
||||
URL: http://rosettacode.org/wiki/FizzBuzz
|
||||
]
|
||||
|
||||
; Concatenative. Note use of 'case/all' construct to evaluate all
|
||||
; conditions. I use 'copy' to allocate a new string each time through
|
||||
; the loop -- otherwise 'x' would get very long...
|
||||
|
||||
repeat i 100 [
|
||||
x: copy ""
|
||||
case/all [
|
||||
0 = mod i 3 [append x "Fizz"]
|
||||
0 = mod i 5 [append x "Buzz"]
|
||||
"" = x [x: mold i]
|
||||
]
|
||||
print x
|
||||
print switch/default 0 compose [
|
||||
(mod i 15) ["fizzbuzz"]
|
||||
(mod i 3) ["fizz"]
|
||||
(mod i 5) ["buzz"]
|
||||
][i]
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue