This behavior mirrors the behavior on .NET; if you run this code in fsi, you will get:

1
2
3
System.NullReferenceException: Object reference not set to an instance of an object.
   at <StartupCode$FSI_0004>.$FSI_0004.main@()
Stopped due to error
By on 5/22/2015 9:09 AM ()

The following returns undefined where I would expect 0.

1
2
3
let test () : int =
    let a2 = Array2D.zeroCreate 1 1
    a2.[0,0]
By on 5/24/2015 7:51 PM ()

So it does. Thank you; I was misled by the name, examples for ints and not usually having to deal with null in F#. It makes sense in terms of how to initialise a value of R and for performance reasons in some cases.

By on 5/24/2015 4:35 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper