IDK updates
This commit is contained in:
parent
b9fa8429a6
commit
7bfdc8d9c0
0
Cargo.toml
Normal file → Executable file
0
Cargo.toml
Normal file → Executable file
90
README.md
Normal file → Executable file
90
README.md
Normal file → Executable file
@ -5,65 +5,55 @@ Embeddable code compiler
|
||||
```
|
||||
// comment
|
||||
|
||||
var a = 0 // create var (you can not create var without initial value)
|
||||
a = 1 // int, set var
|
||||
a = "123" // string, dynamic var type
|
||||
a = {"11": "11"} // map (map<string, string>)
|
||||
// var value types:
|
||||
// null - null
|
||||
// string - "123"
|
||||
// int - 123
|
||||
// float - 12.3
|
||||
// map - {"key": "value"}
|
||||
// list - {"item", "item"}
|
||||
// function - [arg1, arg2] { /* some code */ }
|
||||
|
||||
a."11" = "44" // set value to map item
|
||||
// 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)
|
||||
|
||||
a = {"11", "12"} // list (map<int, string>)
|
||||
var a = "1" // initial var value (can use operations)
|
||||
a = 2 // set var value (can use operations)
|
||||
del a // delete var
|
||||
|
||||
a.0 = "55" // set value to list element
|
||||
let list = {"a", "b"}
|
||||
list.2 = "c" // set value by key/index (maps works definitely the same)
|
||||
|
||||
a = 0.41 // float
|
||||
|
||||
var c = 10
|
||||
|
||||
c = c + a // addition (works with string+string=string)
|
||||
c = c - a // subtraction
|
||||
c = c * a // multiplication (works with string*int=string)
|
||||
c = c / a // division
|
||||
c = c % a // module
|
||||
|
||||
//
|
||||
|
||||
// var types:
|
||||
// int, float, map[key, value], string, null, function, bool
|
||||
|
||||
{
|
||||
var b = 0
|
||||
|
||||
// this is scope
|
||||
|
||||
// <- here local vars for scope
|
||||
var func = [a] { // create function
|
||||
print [a] // using print function
|
||||
return 1 // return data, null by default
|
||||
}
|
||||
|
||||
// <- here global vars for scope
|
||||
1 // just var value
|
||||
|
||||
// global scope cant see local vars (var b in this case)
|
||||
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 {
|
||||
|
||||
if a == 0.42 {
|
||||
// works totally like scope
|
||||
} else {
|
||||
// has no else if or elif
|
||||
|
||||
}
|
||||
|
||||
// logical operations:
|
||||
// a == b a equals b
|
||||
// a >= b a greater than or equals b
|
||||
// a <= b a less than or equals b
|
||||
// a > b a greater than b
|
||||
// a < b a less than b
|
||||
// a != b a not equals b
|
||||
// a || b a or b
|
||||
// a && b a and b
|
||||
// !a not a
|
||||
|
||||
var func = [arg, arg2] { // create function. also work like scope
|
||||
return "123"
|
||||
}
|
||||
|
||||
func ["arg1", "arg2"] // run function
|
||||
|
||||
```
|
0
src/lib.rs
Normal file → Executable file
0
src/lib.rs
Normal file → Executable file
0
src/main.rs
Normal file → Executable file
0
src/main.rs
Normal file → Executable file
0
src/tests.rs
Normal file → Executable file
0
src/tests.rs
Normal file → Executable file
Loading…
Reference in New Issue
Block a user