Choose where you’d like to start

Reverse()

Overview

The reverse() function takes an inputText and returns a text whose characters are in reverse order.

Return Type

  • TEXT

Syntax

<variable> = <inputText>.reverse();

(OR)

<variable> = reverse(<inputText>);
ParameterData typeDescription
<variable>TEXTVariable which will contain the returned text.
<inputText>TEXTThe input text whose characters will be returned in reverse order.

Example 1

 inputText = "Zoho Creator" ; 
 outputText = reverse ( inputText ) ; 
 info outputText ; // Returns "rotaerC ohoZ" 

Example 2

 inputText = "level" ; 
 outputText = reverse ( inputText ) ; 
 if ( inputText == outputText ) 
 { 
 info "Palindrome" ;  
 } 
 else  
 { 
 info "Not a Palindrome" ; 
 } 
 // Returns "Palindrome" 

Example 3

When an input that is not a text is supplied to the reverse() function, it converts the input value as text in the backend and returns a reversed output text.
 inputList = { 1 , 2 , 13 } ; // Input is of List datatype 
 outputText = reverse ( inputList ) ; // Returns 31, 2, 1 
 info outputText ; // Output is of Text datatype 

Related Links

Get Started Now

Execute