Answers for "ref in f#"

C#
-2

ref in f#

let a = ref 5  // allocates a new record on the heap
let b = a      // b references the same record
b := 10        // modifies the value of 'a' as well!

let mutable a = 5 // mutable value on the stack
let mutable b = a // new mutable value initialized to current value of 'a'
b <- 10           // modifies the value of 'b' only!
Posted by: Guest on May-04-2021

C# Answers by Framework

Browse Popular Code Answers by Language