59 lines
1.1 KiB
Markdown
Executable File
59 lines
1.1 KiB
Markdown
Executable File
# Emcode
|
|
|
|
Embeddable code compiler
|
|
|
|
```
|
|
// comment
|
|
|
|
// var value types:
|
|
// null - null
|
|
// string - "123"
|
|
// int - 123
|
|
// float - 12.3
|
|
// map - {"key": "value"}
|
|
// list - {"item", "item"}
|
|
// function - [arg1, arg2] { /* some code */ }
|
|
|
|
// var operations:
|
|
// addition - a + b
|
|
// subtract - a - b
|
|
// multiply - a * b
|
|
// division - a / b
|
|
// module - a % b
|
|
// and - a && b
|
|
// or - a || b
|
|
// equals - a == b
|
|
// not eq - a != b
|
|
// not - !a
|
|
// brackets - (operation)
|
|
|
|
var a = "1" // initial var value (can use operations)
|
|
a = 2 // set var value (can use operations)
|
|
del a // delete var
|
|
|
|
let list = {"a", "b"}
|
|
list.2 = "c" // set value by key/index (maps works definitely the same)
|
|
|
|
var func = [a] { // create function
|
|
print [a] // using print function
|
|
return 1 // return data, null by default
|
|
}
|
|
|
|
1 // just var value
|
|
|
|
func [] // also var value, but it runs function
|
|
|
|
loop { // infinity loop
|
|
skip // skip this loop iteration
|
|
break // break loop
|
|
}
|
|
|
|
if 1 == 2 { // run code on condition
|
|
next // go to next "else" in chain
|
|
} else if 1 != 2 {
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
``` |