Skip to content

Commit 2f6810a

Browse files
committed
[add[ examples for function calls and variable declarations/assignment.
1 parent 9b5a8cd commit 2f6810a

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ This language is still currently experimental with many more features to come.
1616
## Current features with working examples.
1717
* [Classes](examples/class.ls).
1818
* [Inheritance](examples/extends.ls).
19-
* Functions.
20-
* Variables.
19+
* [Functions](examples/func.ls).
20+
* [Variables](examples/variable.ls).
2121
* Conditionals.
2222
* Loops.
2323
* Closures.

examples/func.ls

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Declares a function
2+
func AddTwoNums(num_one, num_two) {
3+
return num_one + num_two;
4+
}
5+
6+
// Invokes function with two literals.
7+
print AddTwoNums(10, 10);

examples/variable.ls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Assigns x to a string.
2+
var x = "hello there";
3+
4+
// Prints x.
5+
print x;
6+
7+
// Reassigns x to a number.
8+
x = 10;
9+
10+
// Prints x.
11+
print x;

0 commit comments

Comments
 (0)