GithubHelp home page GithubHelp logo

seanpm2001-all / learn-moonscript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seanpm2001/learn-moonscript

1.0 2.0 0.0 403 KB

A repository for showcasing my knowledge of the MoonScript programming language, and continuing to learn the language.

License: GNU General Public License v3.0

MoonScript 100.00%

learn-moonscript's Introduction

All Contributors


/MoonScript_PlaceHolderLogo_577px_WHITEBACKGROUND.jpeg

Learning MoonScript

I am not too experienced with MoonScript at the moment. This document will go over my knowledge of the MoonScript language so far.

This document used version 0.5.0 of the MoonScript programming language.

Comments in MoonScript

Comments in MoonScript are the same as comments in Lua, which is the same as languages like VHDL, Elm, etc.

-- This is a single line comment
-- MoonScript does not support multi-line comments (as far as I know)

Break keyword in MoonScript

break

To this day, I am still not entirely sure what the break keyword does, but most languages support it.

/!\ This example has not been tested yet, and may not work

Hello World in MoonScript

A hello world program in MoonScript is pretty simple. It is similar to Lua.

print "Hello World"

/!\ This example has not been tested yet, and may not work

Functions in MoonScript

The process of making functions in MoonScript is pretty simple:

-- An empty function
function1 = ->
-- A hello world function
functionHW = -> print "Hello World"

Compared to Lua:

-- An empty function
local function function1 = ->
function function1 = function() end
function1()
-- A hello world function
local function functionHW = -> print "Hello World"
function functionHW = function() end
functionHW()
Calling a function in MoonScript

Calling a function in MoonScript is very easy, and similar to many languages, such as Python Lua, Rust, C, etc.

function1()

Classes in MoonScript

Classes are supported in MoonScript. They can be defined like so:

class myMoonScriptClass()
print "Welcome to my MoonScript class"

/!\ This example has not been tested yet, and may not work

Source

The majority of my MoonScript knowledge comes from the official MoonScript developer reference it has proven extremely helpful, and I have tested the programs with a CI workflow, and all 11 checks passed every time.

Other knowledge of MoonScript

  1. MoonScript is not a curly bracket language, but and also does not use semicolons at the end of each line

  2. MoonScript is a simplified language that compiles to Lua. Other languages that do this include Haxe, and Amulet.

  3. MoonScript uses the .moon file extension

  4. The syntax of MoonScript is inspired by languages like CoffeeScript.

  5. No other knowledge of MoonScript at the moment.


File version: 1 (2022, Monday, April 4th at 4:27 pm PST)


Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Sean P. Myrick V19.1.7.2

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ ๐Ÿ› ๐Ÿ“ฆ ๐Ÿ“† ๐Ÿ›ก๏ธ ๐Ÿ”ฃ ๐Ÿ–‹ ๐ŸŽจ ๐Ÿšง ๐Ÿค”

All Contributors

๐Ÿ“–

Seanpm2001 MoonScript language

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ ๐Ÿ› ๐Ÿ“ฆ ๐Ÿ“† ๐Ÿ›ก๏ธ ๐Ÿ”ฃ ๐Ÿ–‹ ๐ŸŽจ ๐Ÿšง ๐Ÿค”

This project follows the all-contributors specification. Contributions of any kind welcome!

learn-moonscript's People

Contributors

seanpm2001 avatar allcontributors[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.