Rotate

If you want to swap two value or wants to rotate value of variables, then this attribute is used.

Syntax:

    rotate : (variable1 , variable2, variable3)

NOTE: 'Rotate' requires only variables, other values cannot be inserted into it.

Examples:

Correct Syntax:
    rotate : (val1 , val2 , val3)
or
    rotate : (val1 , val2)

------------ 

Wrong Syntax:
    @ you need to insert all value within round-brackets
    rotate : val1 , val2
or
    @ rotate requires at least two variables
    rotate : (val1)
or
    @ rotate expects only variables, no 
    @ other type of tokens are allowed
    rotate : (val1, "SRON", val2)

Sample code to swap two variables using 'rotate' attribute

OUTPUT:

Before Swap: A = 2706 B = 2003 After Swap: A = 2003 B = 2706


Sample code to rotate values of more than two variables using 'rotate' attribute

OUTPUT:

Before Swap: A = 2706 B = 2003 C = true After Rotate: A = 2003 B = true C = 2706

Last updated