I read about that when deal with array we should use like myArray.[i], however, from my experience myArray[i] compiles too.
However, when I want to write to an array in .Net (so it is mutable), this gives an error let myArray.[i] = 3 but let myArray[i] =3 works.
What is the best practice to deal with such thing?
Also, should I use Array.get or use .[]?
How do I set value to a jagged array e.g. let myArray.[i].[j] = 5
1) If you want to assign a value to an array cell, use the assignment operator
<-:2)
let myArray[i] = 3compiles because the compiler understands it asmyArrayfunction with a list as its argument and returns3. If you read the warning and the type signature, you will see you’re doing it wrong.3)
Array.getis a single call to.[].Array.getis convenient in some cases for function composition and avoiding type annotation. For example you havevs.