Compound data type: Difference between revisions
Content added Content deleted
(Added Prolog) |
|||
Line 1,566: | Line 1,566: | ||
6 |
6 |
||
</pre> |
</pre> |
||
=={{header|Prolog}}== |
|||
Prolog terms ARE compound data types, there is no need to specifically define a type. |
|||
for the purpose of this exercise you could define a rule like so: |
|||
<lang prolog>point(10, 20).</lang> |
|||
This will create static point that can be called: |
|||
<lang prolog>?- point(X,Y). |
|||
X = 10, |
|||
Y = 20.</lang> |
|||
terms can be passed around as values and can have a complex nested structure of any size, eg: |
|||
<lang prolog>person_location(person(name(N), age(A)), point(X, Y)).</lang> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |