Go! (programming language): Difference between revisions

Content deleted Content added
Example: mark source area
m remove <source> because of wikitext in the source code.
Line 35:
The following example illustrates the "ontology-oriented" type and declarations style of Go!:<ref name=applied />
 
<!-- Don't use <source> tag, because there is wikitext in the source code. -->
<source>
 
Gender [[#algebraic|'''::=''']] male | female.
Line 44 ⟶ 45:
home:[] '''=>''' ''string''.
lives:[''string'']{}}.
person:[''string'', ''day'', Gender, ''string''] [[#theory|'''$=''']] person.
person(Nm, Born, Sx, Hm)..{
dayOfBirth() '''=>''' Born.
Line 57 ⟶ 58:
yearsBetween(...) '''=>''' ..
}.
newPerson:[''string'', ''day'', Gender, ''string''] '''=>''' person.
newPerson(Nm, Born, Sx, Hm) '''=>''' $person(Nm, Born, Sx, Hm).
 
</source>
 
{{anchor|algebraic}}The <code>::=</code> rule defines a new [[algebraic data type]], a [[data type]] with only data constructors.