mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-05 20:26:53 +08:00
88c45cccac
- `func` keyword has change to `function`. - `elsif` changed to `else if`
22 lines
395 B
Plaintext
22 lines
395 B
Plaintext
|
|
## Function Tests.
|
|
|
|
def f1 return 'f1' end assert(f1() == 'f1')
|
|
def f2() return 'f2' end assert(f2() == 'f2')
|
|
def f3(a, b, c, d) return c end
|
|
assert(f3('a', 'b', 'c', 'd') == 'c')
|
|
|
|
## Local variables of inner funcions.
|
|
def f4
|
|
l1 = 3.14
|
|
f5 = function
|
|
l2 = 42
|
|
return l2
|
|
end
|
|
assert(f5() == 42)
|
|
end
|
|
f4()
|
|
|
|
# If we got here, that means all test were passed.
|
|
print('All TESTS PASSED')
|