Noble,
An old-fashioned procedural / deterministic programmer struggling with F # functionality ....
I need some counters to record samples from different areas of the program. The following code compiles and works, but "ctr" never grows.
Any help was appreciated, Yang
type Count() as this =
let mutable ctr = 0
do
printfn "Count:Constructor: %A" ctr
member this.upctr : int =
let ctr = ctr + 1
printfn "inCount.upctr %d" ctr
ctr
let myCount = new Count()
printfn "MyCtr1 %d" (myCount.upctr)
let fred = myCount.upctr
let fred = myCount.upctr
source
share