From ea4282747dd91e9a6cc9a7c20b6ad23665fd1801 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 30 Oct 2021 17:20:33 +0200 Subject: [PATCH] semicolons are needed lol --- README.md | 60 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 25f0680..89ae1ec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -_ is a small embeddable scripting language +language_name is a small embeddable scripting language -_ is inspired by Javascript, Lox, Lua, Python, Rust and more +language_name is inspired by Javascript, Lox, Lua, Python, Rust and more # Reference @@ -9,47 +9,47 @@ _ is inspired by Javascript, Lox, Lua, Python, Rust and more Declaring variables using `let` ``` -let hello = 4 +let hello = 4; ``` -Semicolons are not needed +Semicolons are needed :) ``` -let test = 5 -let another = 4 +let test = 5; +let another = 4; ``` The language has strings, numbers, arrays, objects and null and booleans ``` -let string = "hallo" -let number = 4 -let array = [] -let object = {} -let _null = null -let bool = true +let string = "hallo"; +let number = 4; +let array = []; +let object = {}; +let _null = null; +let bool = true; ``` You access properties on objects using `.` ``` -let obj = {} -obj.hi = "hi!" +let obj = {}; +obj.hi = "hi!"; ``` Functions are first class ``` -let obj = {} -obj.hello = helloFn -obj.hello() +let obj = {}; +obj.hello = helloFn; +obj.hello(); ``` Functions are declared using `fn` ``` fn greet(name) { - return "hello, " + name + return "hello, " + name; } ``` @@ -70,15 +70,15 @@ There are many native functions, that can easily be customized and added/removed ``` # rocket game -turnRocketLeft(29) -turnRocketRight(32) +turnRocketLeft(29); +turnRocketRight(32); # chat bot -message.respond("hi") +message.respond("hi"); # dangerous http requests fn callback(html) { - print(html) + print(html); } fetch("https://github.com/Nilstrieb", callback); ``` @@ -86,10 +86,10 @@ fetch("https://github.com/Nilstrieb", callback); Basic arithmetic and boolean logic is available ``` -let a = 5 -let b = 5 -print(a + b / b * b - a % b) -print(true and false or false or true and false) +let a = 5; +let b = 5; +print(a + b / b * b - a % b); +print(true and false or false or true and false); ``` Loops and conditionals @@ -97,15 +97,15 @@ Loops and conditionals ``` let x = true if x { - print("true!") + print("true!"); } else { - print("false :(") + print("false :("); } loop { while 1 > 5 { - print("yeet") - break + print("yeet"); + break; } # no for loops for now, but will be added (probably like python) }