Operators/Array Rotation Right

From FizzFuzz

Jump to: navigation, search

The array-rotation-right operation is indicated by the >> symbols. It is used on an array and an integer.

Format

a >> b

Where a is an array and b is an integer.

Examples

integer a = {1, 2, 3, 4, 5], b = 3
 
for(integer e = 1; e <= a[]; e ++)
    /*
    This will output the following:
    Element 1: 1
    Element 2: 2
    Element 3: 3
    Element 4: 4
    Element 5: 5
    */
 
    environment.outputln("Element [e]: [a[e]]")
 
a[] >> b
 
for(integer e = 1; e <= a[]; e ++)
    /*
    This will output the following:
    Element 1: 3
    Element 2: 4
    Element 3: 5
    Element 4: 1
    Element 5: 2
    */
 
    environment.outputln("Element [e]: [a[e]]")
Personal tools