Correct OCaml record field assignment syntax

Fixed an error in the OCaml article where record field assignments incorrectly used `:` instead of `=`.
Updated example:
```ocaml
let cow = { name = "cow"; color = "brown"; legs = 4 };;
This commit is contained in:
Piyush Ranjan 2024-11-23 14:39:44 +05:30 committed by GitHub
parent bc3598b1cd
commit eeb513929b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -341,9 +341,9 @@ type animal =
;;
let cow =
{ name: "cow";
color: "black and white";
legs: 4;
{ name = "cow";
color = "black and white";
legs = 4;
}
;;
val cow : animal
@ -488,7 +488,7 @@ filter (fun x -> x < 4) [3; 1; 4; 1; 5] ;; (* Gives [3; 1; 1]) *)
(* However, you can create mutable polymorphic fields *)
type counter = { mutable num : int } ;;
let c = { num: 0 } ;;
let c = { num = 0 } ;;
c.num ;; (* Gives 0 *)
c.num <- 1 ;; (* <- operator can set mutable record fields *)
c.num ;; (* Gives 1 *)