.JET Language Support
This extension adds snippets and colors to tokens!\
Read more for documentations!
Declaring Variables
Declaring variables is quite easy
push variableName -> "this is a string variable"
array variableName -> [1, 2, 3, 4]
object variableName -> { "key": "Hello World!" }
There are 3 types of variables
- push
- Default one, can be set as String, Integer, Float and a Boolean. it cannot store Arrays or Objects
- array
- object:
Importing JSON Files
Importing JSON files is quite easy as well!
IMPORT variableName -> "path/to/json/file"
NOTE: IT CAN IMPORT ANY FILE BUT ONLY JSON FILES WORK!
Getting Elements from an array
Getting elements from an array is different in .JET
get arrayVariable -> variableNameToStoreIn -> 0
// Last one is an index
Getting Elements from an object
Getting elements from an object is different in .JET
$get objectVariable -> variableNameToStoreIn -> keyName
While, If and For statements
if >> value1 === value2
// Code here
STOP
while >> value1 === value2
// Code here
STOP
for >> i >> amount
// Code here
STOP
Functions
// With arguments
FUNC funcName >> argument1, argument2
// Code here
STOP
funcName("hi", "world")
#Without arguments
FUNC funcName >> null
// Code here
STOP
funcName(null)
NOTE: Arguments are stored as variables! name every argument as differnet names!
Array Functions
Now you may be wondering "How can i modify arrays?"
In .JET It's quite different
array arrayName -> [1, 2, 3, 4, 5]
$remove arrayName -> index
$join arrayName -> ", "
$move arrayName -> from, to
$index arrayName -> nameToSaveIn -> "1|2|3"
//In $index it gets an index from REGEX Match (without / /g)
$elem arrayName -> nameToSaveIn -> "1|2|3"
//In $elem it gets an element from REGEX Match (without / /g)
$shift arrayName
//Removes the first element from an array
$pop arrayName
//Removes the last element from an array
$slice arrayName -> 3
//Removes AMOUNT of elements from an array starting from Index 0
Object Functions
object objName -> { "key": "hello", "key2": "world" }
$delete objName -> key
//Deletes a key from an object
#Variables in string
push variable -> "Hello World"
PRINT "Robot says: #{variable}"
Website development
The most important part:
Website Development
$listen 5000 -> "Listening to 5000"
//5000 is a port
$json
//$json allows fetch to post a body
$bodyparams
//$bodyparams allows the backend to read posted body/form
$viewengine "ejs"
//Sets viewengine, USE EJS! EJS
//IS SUPPORTED!
$static "/"
//Usable in HTML
//Example:
//<link rel="stylesheet" href="/css/style.css">
Get
GET >> "/"
$render "index.ejs"
STOP
//After you set a view engine, create a folder called views and put .ejs files there
Post
POST >> "/users"
$returnjson -> { "user1": { "name: "example1234" } }
STOP
Get Fetch
$fetchget -> variableName -> "URL" -> { "Headers": "Hi" }
Post Fetch
$fetchpost -> variableName -> "URL" -> { "Headers": "Hi" } -> { "stuff": "stuff" }
//To make a body empty, just do {} REMEMBER! YOU CANNOT GO TO ANOTHER LINE IN OBJECTS AND ARRAYS!
Set Interval and Clear Interval
INTERVAL >> variableName >> 1000
PRINT "Hello World!"
STOP
CLEARINTERVAL variableName
Set Timeout and Clear Timeout
TIMEOUT >> variableName >> 1000
PRINT "Hello World!"
STOP
CLEARTIMEOUT variableName