Compound data type: Difference between revisions
Content added Content deleted
(Added to the perl section) |
(Added Oz example.) |
||
Line 458: | Line 458: | ||
Another option would be a simple class. |
Another option would be a simple class. |
||
=={{header|Oz}}== |
|||
A point can be represented by using a record value: |
|||
<lang oz>P = point(x:1 y:2)</lang> |
|||
Now we can access the components by name: P.x and P.y |
|||
Often such values are deconstructed by pattern matching: |
|||
<lang oz>case P of point(x:X y:Y) then |
|||
{Show X} |
|||
{Show Y} |
|||
end</lang> |
|||
=={{header|Pascal}}== |
=={{header|Pascal}}== |