I was recently reading this post inwhich the amazing Ady Ngom was disscussing different ways to solve the common FizzBizz challenge given in interviews and how to refactor and streamline your code.
This gave me an idea.
What if we ask the community here to write their own solution to the FizzBuzz challenge in their given language.
What to do:
--[[
Write a program that prints the numbers from 1 to 100.
But for multiples of three print Fizz instead of the number,
For the multiples of five print Buzz and for numbers
which are multiples of both three and five print FizzBuzz
--]]
Rules:
- Have fun!
- Don't copy others code, keep it unique π.
- Use this format:
Language: e.g Python
Code:
Other/info: e.g Hia folks, I like cheese.
Lets see how many different languages we can get here!
(You can make it as simple or as complex as you like.)
Latest comments (20)
Language: JavaScript
Code: gist.github.com/reinhart1010/d2b81...
Other/Info: The above code execute
console.logcommand for each number. And yes, this is compiled on JSFuck based on the original code:Trying to decode the first snippet on JSUnFuck will likely to cause browsers to hang.
Interestingly, this one can be exported to C with minimal modifications:
JavaScript should be welcoming to my folks who are currently learning C thanks to similarity in syntaxes. (If you're reading this, good luck in facing your mid-term exams next week!)
Language: Haskell
Code:
Language: Javascript
Code:
Language: Java (8 and above)
Code:
Language: Erlang
Code:
Short version, generate a list (of strings and integers), donβt bother printing:
Full version, print one term per line. Here we have to convert integers to strings:
Language: SSTNPL
Code:
Other/Info: Figured I'd contribute something a bit more obscure. :) SSTNPL is an architecture-specialized programming language thats used with my SBTCVM ternary computer simulator. Yes, its a bit clunkier-looking than most of the examples here, but mainly down to it using labeled GOTOs...
Very interesing, thank you for sharing. Never heard of SSTNPL and even a quick google search doesn't render many results. π Thanks!
SSTNPL is somthing i put together for SBTCVM specifically. its kinda somehwhere between an assembler (as it compiles to SBTCVM's assembly language), and C, with a bit of a primitive syntax, and a fairly static structure. Its simple, but it does have a few neat features like 2-axis array-like tables, and a module system.
as far as SBTCVM itself, the blog's about page has a good overview of it:
sbtcvm.blogspot.com/p/about.html
Language: Emacs Lisp
Code:
Language: Python
Code:
Language: Smalltalk
Code:
πππ, never used that language.
Language: ReasonML
Sketch: sketch.sh/s/XABe2ghxBqncDWTTKpNK8n/