Reverse String


string - A string


The reversal of the input string, or an empty string if the input is not a string.

Variables Used

s, temp, i
All are created locally in the program.

Calculator Compatibility


:Local i,temp
:If getType(s)=getType(temp) Then
: For i,1,dim(s)
:  mid(s,i,1)&temp→temp
: EndFor

This function requires the user to enter a string as an argument. Many would object that a "return" is needed at the end. This is not true, because, if there is no "return" statement, the calculator automatically returns the last value that it calculated.

Error Conditions


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License