Sign in Join
Wiki copytemporary

Colon

English · Français · Suomi · Русский · 中文(中国)

The symbol :, pronounced “colon”, is used in Pascal in several ways:

The following example shows the most prevalent usage scenarios:

pascal
program colonDemo(input, output, stderr);

procedure numberReport(const i: int64);
begin
    case i of
        low(i)..-1:
        begin
            writeLn('Your number is negative. ☹');
        end;
        1..high(i):
        begin
            // right aligns to a width of 24 characters
            writeLn(i:24);
        end;
        else
        begin
            writeLn('You''ve entered zero.');
        end;
    end;
end;

var
    i: int64;

begin
    writeLn('Enter a number:');
    readLn(i);
    numberReport(i);
end.

other remarks


From the Free Pascal wiki, page "Colon", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.