Previous Up Next

5.49.22  Exchange two rows: rowSwap, rowswap, swaprow

rowSwap (or rowswap or swaprow) takes three arguments: a matrix A and two integers n1 and n2.
rowSwap returns the matrix obtained by exchanging in A, the row of index n1 with the row of index n2.
Input:

rowSwap([[1,2],[3,4]],0,1)

Output:

[[3,4],[1,2]]

Previous Up Next