Bonsoir a tous,
j'essaie de creer un module qui ait le type objet et qui soit : soit une epee soit arc etc...
mais j'obtiens une erreur de syntaxe et je ne vois pas pourquoi ! Si vous pouviez m'eclairer!! merci bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 module Objet = struct (* objets d'attaques *) type epee = {nom : string ; atk : int} type arc = {nom : string ; atk : int} type hache = { nom : string ; atk : int} (* objets de defense *) type bouclier = {nom : string ; def_arc : int ; def_autre : int } type cotte_maille = { nom : string ; def_arc : int ; def_autre : int } type casque = { nom : string ; def : int } (* objets de soin *) type potion = { nom : string ; pv : int } (* type plus general *) type objet = obj : epee | obj : arc | obj : hache | obj : bouclier | obj : cotte_maille | obj : casque end
Partager