mirror of
https://github.com/artegoser/ONLang
synced 2025-02-20 19:23:14 +03:00
feat: beta functions
This commit is contained in:
parent
ef212320da
commit
1a693e38dd
4 changed files with 238 additions and 93 deletions
|
@ -275,6 +275,25 @@
|
|||
"After scope",
|
||||
['isExist("scoped"): ', { isExist: "scoped" }],
|
||||
|
||||
"Creating function `sum`",
|
||||
{
|
||||
fn: {
|
||||
name: "sum",
|
||||
args: ["first", "second"],
|
||||
body: [
|
||||
{
|
||||
return: {
|
||||
calc: [{ var: "sum.first" }, "+", { var: "sum.second" }],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
"Run function `sum`",
|
||||
|
||||
["fn sum(first, second){ return first+second}; sum(2,2) = ", { sum: [2, 2] }],
|
||||
|
||||
"\nInput a var",
|
||||
{
|
||||
let: {
|
||||
|
|
Loading…
Add table
Reference in a new issue