Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'programming difficulties' topicStudent Support Forum > General > "programming difficulties"

Next Comment >Help | Reply To Topic
Author Comment/Response
Rhyannon
10/15/99 11:19pm


I want to design a simple recursive program that tells whether a
word is a palindrome or not. I do not understand where to increment
''i''. My program is now as follows:
palindrome[] = ''Your Word is a Palindrome'';
palindrome[d] = ''Your Word is a Palindrome'';
palindrome[''word''_] :=
Module[{n, i = 1, i++},
n = StringLength[''word''];
If[StringTake[''word'', {i}] == StingTake[''word'', {-i}],
i++, Return[''Try Again'']
]
]

I have played around with this above program for hours; can you
give me a hint?
Thanks!


URL: ,

Subject (listing for 'programming difficulties')
Author Date Posted
programming difficulties Rhyannon 10/15/99 11:19pm
Re: programming difficulties Forum Modera... 10/22/99 5:56pm
Next Comment >Help | Reply To Topic