I am trying to create a function in F # that takes a two-dimensional array of integers (9 by 9) as input and subsequently prints its contents. The following code shows what I did:
let printMatrix matrix= for i in 0 .. 8 do for j in 0 .. 8 do printf "%d " matrix.[i,j] printf "\n"
The problem is that F # does not automatically output the type of the matrix, and this gives me the following error: "The operator 'expr. [Idx]' used an object of an undefined type based on the information before this program point. Consider adding additional type restrictions."
I tried using type annotation in the function definition, but I think I did it wrong. Any idea how I can overcome this problem?
source share