Compound data type: Difference between revisions

Content added Content deleted
Line 294: Line 294:
Then they can be assigned using the assignment operator "<-"
Then they can be assigned using the assignment operator "<-"
<ocaml>let p2 = { x2 = 4; y2 = 5 } in
<ocaml>let p2 = { x2 = 4; y2 = 5 } in
p2.x2 <- 6
p2.x2 <- 6;
p2 (* evaluates to { x2 = 6; y2 = 5 } *)</ocaml>
p2 (* evaluates to { x2 = 6; y2 = 5 } *)</ocaml>