We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello!
I want to make a program that includes a function. The function should reverse a word. For example if I type in Hello, it should end up with olleH. My question is how the code would look like for this program.
Thank you in advance, Lugi5000
Answers
Thank you for your answer!
@Lugi5000 -- Notice that the solution by @GoToLoop treats the string as a list of characters (a character array). You can use
reverse()
to reverse any array.@jeremydouglass But what if I reverse the word with a string and the command return?
I don't understand. Is that a question? What if...?
@jeremydouglass Yes this is a question. I am sorry, I am from Austria :)
Oh, I see. "What if" is perfectly good English -- I just wasn't understanding "and the command return." You want to use a function, and then return its value with
return
, like in GoToLoop's example.