define reference cell
> let refCellInt = ref 10;; val refCellInt : int ref = {contents = 10;}
change value in reference cell
> refCellInt := 20;; val it : unit = () > System.Console.WriteLine(refCellInt.Value);; 20 val it : unit = ()
undefine reference cell
> let normallInt = !refCellInt;; val normallInt : int = 20
No comments:
Post a Comment