Test a function: Difference between revisions

Actually do the changes indicated in previous edit.
(First program updated to work with Nim 1.6: added missing parameter types. Changed "reverse" to "reversed".)
(Actually do the changes indicated in previous edit.)
Line 1,257:
=={{header|Nim}}==
Using assertions (No output means all tests were correct, only works with debug builds!):
<lang nim>proc reversereversed(s: string): string =
result = newString(s.len)
for i, c in s:
result[s.high - i] = c
 
proc isPalindrome(s: string): bool =
s == reversereversed(s)
 
when isMainModule:
Anonymous user