embeddable code language
Go to file
2025-01-08 19:55:44 +03:00
src var value parse and some 2025-01-08 19:55:44 +03:00
.gitignore gitignore 2025-01-07 03:36:39 +03:00
Cargo.toml cargo init 2025-01-07 03:35:59 +03:00
LICENSE Initial commit 2025-01-06 01:50:47 +00:00
README.md var value parse and some 2025-01-08 19:55:44 +03:00
test.emc var value parse and some 2025-01-08 19:55:44 +03:00

Emcode

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>)

a."11" = "44" // set value to map item

a = {"11", "12"} // list (map<int, string>)

a.0 = "55" // set value to list element

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
}

// <- here global vars for scope

// global scope cant see local vars (var b in this case)

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