added strcat builtin

This commit is contained in:
Francesco Cozzuto
2021-12-01 13:19:18 +01:00
parent fba9698b8b
commit 3238c2fb8e
3 changed files with 105 additions and 12 deletions
+10 -8
View File
@@ -1,12 +1,14 @@
depth = 9;
fun fail(p)
fun fail_at_depth(depth)
{
if p < depth:
fail(p+1, depth, fail);
else
assert(false);
fun fail(current_depth)
{
assert(current_depth < depth);
fail(current_depth + 1);
}
fail(0);
}
fail(0);
fail_at_depth(9);
+22
View File
@@ -0,0 +1,22 @@
A = 'Hello';
B = ', ';
C = 'world';
D = strcat(A, B, C);
fun append_esclamation_mark(A, n)
{
if n == none:
n = 1;
i = 0;
while i < n:
{
A = strcat(A, '!');
i = i + 1;
}
return A;
}
print(append_esclamation_mark(D, 7), '\n');