Compound data type: Difference between revisions
PascalABC.NET
imported>Arakov |
(PascalABC.NET) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 575:
=={{header|COBOL}}==
A compound data item description is possible in COBOL as a subdivided record:
<syntaxhighlight lang="cobol"> DATA DIVISION.
WORKING-STORAGE SECTION.
01 Point.
05 x
05 y
Here the record <code>Point</code> has the subdivisions <code>x</code> and <code>y</code>, both of which are signed 16-bit binary integers.
=={{header|CoffeeScript}}==
Line 952 ⟶ 954:
3 4
</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
CGRect r = {0, 0, 250, 100}
printf @"x = %.f : y = %.f : width = %.f : height = %.f", r.origin.x, r.origin.y, r.size.width, r.size.height
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
x = 0 : y = 0 : width = 250 : height = 100
</pre>
=={{header|Go}}==
Line 1,782 ⟶ 1,798:
x, y: integer;
end;</syntaxhighlight>
=={{header|PascalABC.NET}}==
Classes in PascalABC.NET are reference types and records are value types.
<syntaxhighlight lang="pascal">
type
Point = class
x,y: integer;
constructor(x,y: integer) := (Self.x,Self.y) := (x,y);
end;
PointRec = record
x,y: integer;
constructor(x,y: integer) := (Self.x,Self.y) := (x,y);
end;
begin
var p := new Point(2,3);
Println(p.x,p.y);
var pr := new PointRec(4,5);
Println(pr.x,pr.y);
end.
</syntaxhighlight>
=={{header|Perl}}==
Line 2,785 ⟶ 2,822:
=={{header|Wren}}==
<syntaxhighlight lang="
construct new(x, y) {
_x = x
|