🎉
This commit is contained in:
12
tests/fib.plthy
Normal file
12
tests/fib.plthy
Normal file
@ -0,0 +1,12 @@
|
||||
hello|
|
||||
define fib<1> as [
|
||||
return 1 if argument #1 = 1|
|
||||
return 1 if argument #1 = 2|
|
||||
return do "fib"<argument #1-1;> + do "fib"<argument #1-2;>|
|
||||
]|
|
||||
do print<do "fib"<1;>;>|
|
||||
do print<do "fib"<2;>;>|
|
||||
do print<do "fib"<3;>;>|
|
||||
do print<do "fib"<6;>;>|
|
||||
do print<do "fib"<10;>;>|
|
||||
goodbye|
|
4
tests/function.plthy
Normal file
4
tests/function.plthy
Normal file
@ -0,0 +1,4 @@
|
||||
hello|
|
||||
define five<0> as return 5|
|
||||
do print<do "five"<>;>|
|
||||
goodbye|
|
5
tests/if.plthy
Normal file
5
tests/if.plthy
Normal file
@ -0,0 +1,5 @@
|
||||
hello|
|
||||
$2 -> x|
|
||||
do print<'a';> if variable x = 1|
|
||||
do print<'b';> if variable x = 2|
|
||||
goodbye|
|
10
tests/math.plthy
Normal file
10
tests/math.plthy
Normal file
@ -0,0 +1,10 @@
|
||||
hello|
|
||||
$1 -> x|
|
||||
$2 -> y|
|
||||
$5 -> z|
|
||||
$variable x+variable y -> z| // 3
|
||||
$5-variable z -> z| // 2
|
||||
$2*variable z -> x| // 4
|
||||
$variable x/variable y -> y| // 2
|
||||
do print<variable x;variable y;variable z;>|
|
||||
goodbye|
|
5
tests/maybe.plthy
Normal file
5
tests/maybe.plthy
Normal file
@ -0,0 +1,5 @@
|
||||
hello|
|
||||
$1 -> x|
|
||||
maybe $variable x + 1 -> x|
|
||||
do print<variable x;>|
|
||||
goodbye|
|
2
tests/none.plthy
Normal file
2
tests/none.plthy
Normal file
@ -0,0 +1,2 @@
|
||||
hello|
|
||||
goodbye|
|
6
tests/precedence.plthy
Normal file
6
tests/precedence.plthy
Normal file
@ -0,0 +1,6 @@
|
||||
hello|
|
||||
$ 1 + 2 * 3 -> x|
|
||||
do print<variable x;>|
|
||||
$ 5 -> y if variable x = 7|
|
||||
do print<variable y;>|
|
||||
goodbye|
|
6
tests/scope.plthy
Normal file
6
tests/scope.plthy
Normal file
@ -0,0 +1,6 @@
|
||||
hello|
|
||||
[
|
||||
$5 -> x|
|
||||
do print<variable x;>|
|
||||
]|
|
||||
goodbye|
|
4
tests/variable.plthy
Normal file
4
tests/variable.plthy
Normal file
@ -0,0 +1,4 @@
|
||||
hello|
|
||||
$2 -> x|
|
||||
do print<variable x;>|
|
||||
goodbye|
|
Reference in New Issue
Block a user