1
let arr = [| for i in 1.. 10 -> 0, 0.0|]
By on 1/3/2010 12:11 PM ()

A snippet says more than 1 kword:

1
2
3
4
5
6
//code below inits the aray with nulls, which may not be what you want
let (arrTuples:(int*float)[]) = Array.zeroCreate 42


//To properly initialize an array, use init
let arrTuples2 = Array.init 42 (fun _ -> (0,0.0)) //wildcard _ means "I don't care about the index" 
By on 1/3/2010 4:53 AM ()

Hello, cfern:
Thank you very much for your code, it works.
By the way, it is not easy to know that "_" can stand for don't care about index.
Thanks and Happy New Year to you!

By on 1/3/2010 10:16 AM ()
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