PROGRAM vector ! illustrate use of arrays DIM a(3),b(3) ! arrays defined in DIM statement CALL initial(a(),b()) CALL dot(a(),b()) CALL cross(a(),b()) END SUB initial(a(),b()) LET a(1) = 2 LET a(2) = -3 LET a(3) = -4 LET b(1) = 6 LET b(2) = 5 LET b(3) = 1 END SUB SUB dot(a(),b()) LET dot_product = 0 FOR i = 1 to 3 LET dot_product = dot_product + a(i)*b(i) NEXT i PRINT "scalar product = "; dot_product END SUB SUB cross(r(),s()) ! arrays can be defined in main program or subroutine ! note use of dummy variables DIM cross_product(3) FOR component = 1 to 3 LET i = mod(component,3) + 1 LET j = mod(i,3) + 1 LET cross_product(component) = r(i)*s(j) - s(i)*r(j) NEXT component PRINT PRINT "three components of the vector product:" PRINT " x "," y "," z " FOR component = 1 to 3 PRINT cross_product(component), NEXT component END SUB