Skip to content

Commit 499c326

Browse files
authored
Correct erroneous strlen computation in cancer.alan (#42)
Fixes #41
1 parent 3d43526 commit 499c326

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

alan/programs/cancer.alan

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ cancer() : proc
2020
{
2121
writeString("Give a string with maximum length 30: ");
2222
readString(30, source);
23-
n = 0;
24-
while (source[n]!='\0')
25-
n = n+1;
26-
n = n-1;
23+
writeString(source);
24+
n = strlen(source);
2725
if (is_it(n, source) == 1)
28-
writeString("\nIs not palindrome...");
26+
writeString(" ... is not palindrome\n");
2927
else
30-
writeString("\nIs palindrome...");
28+
writeString(" ... is palindrome\n");
3129
}
3230

0 commit comments

Comments
 (0)