I am distorting some SQL stored procedures with I / O parameters. This, of course, means that I have to do ugly things, such as declaring my parameters as a reference and using mutables.
How do I do this in F #?
F # really has a parameter byref. Here is an example MSDN page:
byref
type Incrementor(z) = member this.Increment(i : int byref) = i <- i + z
( ref mutable, ). MSDN - , /.
ref
mutable
:
// Declare a reference. let refVar = ref 6 // Change the value referred to by the reference. refVar := 50
// Declare a reference. let mutable refVar = 6 // Change the value referred to by the reference. refVar <- 50
, ( ) .