F# Reference Cells
Reference cells refer to memory locations. It allows you to create mutable values. F# uses immutable data structure by default.
You can create reference cells by using ref operator. It holds actual value.
Reference cells can be dereferenced by using! (Bang) operator. It uses : = operator to assign new value.
F# Reference Cells Example
F# Reference Cells Example2
F# Reference Cells Value Property and Contents Field Example
F# Reference Cells vs. Mutable Variables
Reference cells and mutable variables both can be used in all situations except that compiler does not allow to use mutable variables in lambda expressions, sequence expressions etc. In such scenario, you can use reference cells.