procedure multiply_matrix (m1, m2) result := [] # to hold the final matrix every row1 := !m1 do { # loop through each row in the first matrix row := [] every colIndex := 1 to *m1 do { # and each column index of the result value := 0 every rowIndex := 1 to *m2 do { value +:= row1[rowIndex] * m2[rowIndex][colIndex] } put (row, value) } put (result, row) # add each row as it is complete } return result end