Sitemap
Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Member-only story

Exploring Programming Languages — MoonScript

--

Press enter or click to view image in full size
A robot coding on a laptop while sitting on the moon. You can see the Earth from afar
Generated by Google’s Gemini

Let’s continue our exploration of programming languages with a new, interesting one: MoonScript.

Not a Medium subscriber? 😕 You can read this post for free here 🥳

MoonScript is a relatively new language, as it’s only 13 years old. It was first published in 2013.

I think I heard about MoonScript a few years back, but never really paid attention to it.

Fun fact: MoonScript is a CoffeeScript-inspired language that compiles to Lua.

Ok, let’s jump into our main topic, which is creating an LED Numbers application.

The application should work like this: we input 1977, and it returns:

1997 written in LED Numbers
LED Numbers output

Now, keep in mind that we want to show this to newcomers to MoonScript, not to seasoned developers.

The first thing we’re going to do is create a Table (Dictionary) that holds lists (Similar to a Map in other languages) to hold all the components of the LED numbers:

leds = {"0": {" _  ","| | ","|_| "},
"1": {" ","| ","| "},
"2": {" _ "," _| ","|_ "},
"3": {"_ ","_| ","_| "},
"4": {"…

--

--

Senior Developer Advocate 🥑, Author of the Frankie Programming Language, Programming Languages Archaeologist, Punk Dad. Love @AFI

Dev Genius
Dev Genius

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development