Input/Output for lines of text: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl example) |
(add →Free Pascal: implementation [allegedly inserting external links]) |
||
Line 174: | Line 174: | ||
Pack my Box with 5 dozen liquor jugs |
Pack my Box with 5 dozen liquor jugs |
||
</pre> |
</pre> |
||
=={{header|Free Pascal}}== |
|||
This requires FPC – the FreePascal compiler – to be in a configuration enabling the use ob <tt>object</tt>s. |
|||
<lang pascal>program head(input, output, stdErr); |
|||
type |
|||
obj = object |
|||
public |
|||
procedure method(const s: string); static; |
|||
end; |
|||
procedure obj.method(const s: string); |
|||
begin |
|||
writeLn(s); |
|||
end; |
|||
var |
|||
numberOfLines: integer; |
|||
line: string; |
|||
begin |
|||
readLn(numberOfLines); |
|||
for numberOfLines := numberOfLines downto 1 do |
|||
begin |
|||
readLn(line); |
|||
obj.method(line); |
|||
end; |
|||
end.</lang> |
|||
=={{header|Go}}== |
=={{header|Go}}== |