For the complete documentation index, see llms.txt. This page is also available as Markdown.

ArrayTranspose

Returns a transposed array based on all passed in arrays.

 arrayTranspose(
     [ 1, 2, 3 ],
     [ 4, 5, 6 ],
     [ 7, 8, 9 ]
 );
 // [ [ 1, 4, 7 ], [ 2, 5, 8 ], [ 3, 6, 9 ] ]
 

Method Signature

ArrayTranspose()

Arguments

This function does not accept any arguments

Examples

Swap rows and columns in a 2D array

matrix = [
    [ 1, 2, 3 ],
    [ 4, 5, 6 ]
];
result = matrix.transpose();
writeOutput( result.len() & "," & result[ 1 ].len() );

Result: 3,2

Transposed result

Result: [1, 3]

Using the global function form

Result: [b, d]

Last updated

Was this helpful?