Smart pascal source code
type
TRect = record
Left: Integer;
Top: Integer;
Right: Integer;
Bottom: Integer;
end;
function Rect(const Left, Top, Right, Bottom: Integer): TRect;
begin
Result.Left := Left;
Result.Top := Top;
Result.Right := Right;
Result.Bottom := Bottom;
end;
function RectToStr(const R: TRect): String;
var X: Integer;
begin
X := R.Left + R.Top + R.Right + R.Bottom;
Result := IntToStr(X);
end;
WriteLn(RectToStr(Rect(50, 40, 30, 20)));
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
140
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Copy$TRect(s,d) {
d.Left=s.Left;
d.Top=s.Top;
d.Right=s.Right;
d.Bottom=s.Bottom;
return d;
}
function Clone$TRect($) {
return {
Left:$.Left,
Top:$.Top,
Right:$.Right,
Bottom:$.Bottom
}
}
function RectToStr(R) {
var Result = "";
var X = 0;
X = R.Left+R.Top+R.Right+R.Bottom;
Result = X.toString();
return Result
};
function Rect(Left$1, Top$1, Right$1, Bottom$1) {
var Result = {Left:0,Top:0,Right:0,Bottom:0};
Result.Left = Left$1;
Result.Top = Top$1;
Result.Right = Right$1;
Result.Bottom = Bottom$1;
return Result
};
/* <<< main JS >>> */
WriteLn(RectToStr(Rect(50,40,30,20)))