feat: add monkey-rs
This commit is contained in:
24
__lang/monkey-rs/examples/sample.mky
Normal file
24
__lang/monkey-rs/examples/sample.mky
Normal file
@@ -0,0 +1,24 @@
|
||||
let s1 = "str1";
|
||||
let s2 = "str2";
|
||||
|
||||
let s3 = s1 + " - " + s2;
|
||||
s3;
|
||||
len(s3);
|
||||
|
||||
|
||||
let x = 10;
|
||||
let y = 20;
|
||||
|
||||
let sum = fn(a, b){ a + b;};
|
||||
sum(x, y);
|
||||
|
||||
let arr = [1, 2, 3, 4];
|
||||
sum(arr[0], arr[3]);
|
||||
|
||||
let dict = {"one": 1, "two": 2, "three": 3};
|
||||
sum(dict["one"], dict["two"]);
|
||||
|
||||
let fact = fn(x){ if (x > 1) { x * fact(x - 1);} else {1}};
|
||||
fact(10);
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user