During the Philadelphia Rebol Conference lead REN-C developer Brian “HostileFork” Dickens presented this REN-C version of the classic programming task of “Fizz Buzz”.
I decided to use REN-C as a new means of producing CGI output on the site. After some trial and error I managed to get the cookie-warning-generating code on the PHP version of the site to work using this REN-C program. And to have some none trivial output I though about using this FizzBuzz example, also because the Rebol would not be able to process this code, proving it really would be the renc executable that processed the code.
But working as a separate script did not go well. Even older Rebol scripts did not seem to be working. After some help from community member Chris Ross-Gill there was some progress, But only after putting a question out to my hosting provider regarding the settings and possible changes during the transfer to a new service, and after additional tinkering on my side things suddenly came to life again. So probably it was all not working due to my own doing in the end.. but there is a result to be shown.
REN-C source code used
#!/path-to/cgi-bin/renc
REBOL [Title: "FizzBuzz for CGI in REN-C"]
print "Content-Type: text/html; charset=utf-8^/"
count-up n 100 [
print [ unspaced [
if n mod 3 = 0 ["Fizz"]
if n mod 5 = 0 ["Büzz"]
] else [n]]
print "<br />"
]
And what does it result in?
1
2
Fizz
4
Büzz
Fizz
7
8
Fizz
Büzz
11
Fizz
13
14
FizzBüzz
16
17
Fizz
19
Büzz
Fizz
22
23
Fizz
Büzz
26
Fizz
28
29
FizzBüzz
31
32
Fizz
34
Büzz
Fizz
37
38
Fizz
Büzz
41
Fizz
43
44
FizzBüzz
46
47
Fizz
49
Büzz
Fizz
52
53
Fizz
Büzz
56
Fizz
58
59
FizzBüzz
61
62
Fizz
64
Büzz
Fizz
67
68
Fizz
Büzz
71
Fizz
73
74
FizzBüzz
76
77
Fizz
79
Büzz
Fizz
82
83
Fizz
Büzz
86
Fizz
88
89
FizzBüzz
91
92
Fizz
94
Büzz
Fizz
97
98
Fizz
Büzz
For more about REN-C go to https://github.com/metaeducation/ren-c
Next up is a course on how to produce long articles for your blog 😉