The below code gives the error The operator 'expr.[idx]' has been used an object of indeterminate type based on information prior to this program point. Consider adding further type constraints. I think i have told it the type. What is wrong?
let board = Array2D.init 30 30 (fun x y -> 0)
let tickCell x y board : int[,] =
match board with
|board when board.[x].[y] = 0-> 1
|board when board.[x].[y] = 1-> 0
| _ -> -1
let board2 = Array2D.init 30 30 (fun x y -> tickCell x y board)
These small changes should get rid of the error:
boardparameter and type in parenthesisAccess the cell with
[x,y]