Reputation: 3
I would just like to know why this returns an "Expected end of statement" whenever I call the function multiply_matrix(matrixA, matrixB) and feed it with matrixA (3x3 matrix), and matrixB(3x3 matrix). The error is always at "Next k".
This is the code of the function.
Function multiply_matrix(matrixA, matrixB)
dim answer_matrix(3,3)
for i=0 to UBound(matrixA,1)
for j=0 to UBound(matrixB,2)
sum = 0
for k=0 to UBound(matrixB,1)
sum = sum + ( matrixA(i,k) * matrixB(k,j) )
next k
answer_matrix(i,j) = sum
next j
next i
multiply_matrix = answer_matrix
End Function
Upvotes: 0
Views: 678
Reputation: 38745
Other Basic dialects allow variable names after the Next
, VBScript doesn't.
Upvotes: 1