adambard / adambard/learnxinyminutes-docs

Collection Instanciation Error : OCaml

Aperta
#5,003 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Markdown
Stelle
12.3k
Fork
3.7k
Merge medio
13h 10m
PR unite (30g)
6

Descrizione

I noticed an error in the `Records/A collection of values with named fields` chapter when instantiating `cow` variable:
```ocaml
type animal =
{
name: string;
color: string;
legs: int;
}
;;

let cow =
{ name: "cow";
color: "black and white";
legs: 4;
}
;;
val cow : animal

cow.name ;;
- : string = "cow"
```
This should be replaced by
```ocaml
type animal =
{
name: string;
color: string;
legs: int;
}
;;

let cow =
{ name = "cow";
color = "black and white";
legs = 4;
}
;;

(*
val cow : animal

cow.name ;;
- : string = "cow"
*)
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.