simplified code and fixed a bug
This commit is contained in:
+6
-8
@@ -1,20 +1,18 @@
|
||||
|
||||
A = 'Hello';
|
||||
B = ', ';
|
||||
C = 'world';
|
||||
D = strcat(A, B, C);
|
||||
|
||||
fun append_esclamation_mark(A, n)
|
||||
{
|
||||
fun append_esclamation_mark(A, n) {
|
||||
|
||||
if n == none:
|
||||
n = 1;
|
||||
|
||||
i = 0;
|
||||
while i < n:
|
||||
{
|
||||
A = strcat(A, '!');
|
||||
i = i + 1;
|
||||
}
|
||||
while i < n: {
|
||||
A = strcat(A, '!');
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
return A;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user