Compound data type: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: === Dictionary ===)
Line 691: Line 691:
Var:Point point;
Var:Point point;
}</lang>
}</lang>


=={{header|Lasso}}==
In Lasso, a point could just be stored in the pair type. However, assuming we want to be able to access the points using the member methods [Point->x] and [Point->y], let's just create a type that inherits from the pair type:
<lang lasso>define Point => type {
parent pair

public onCreate(x,y) => {
..onCreate(#x=#y)
}

public x => .first
public y => .second
}

local(point) = Point(33, 42)
#point->x
#point->y</lang>

{{out}}
<pre>33
43</pre>



=={{header|Logo}}==
=={{header|Logo}}==