Sign in Join
Wiki copytemporary

Greater than

English · Français · Suomi · Русский

>

In ASCII, the character code decimal 62 (or hexadecimal 3E) is defined to be > (greater-than sign).

comparison operator

true greater than

The greater than symbol > is used to compare whether the value on the left side of the symbol, exceeds that of the value to the right side of the symbol. The expression results in a boolean value.

pascal
program comparisonDemo(input, output, stderr);

type
    size = (tiny, small, medium, large, huge);

var
    n, m: longint;
    c, d: char;

begin
    // of course, integers can be compared
    n :=  2;
    m := -2;
    
    if n > m then
    begin
        writeLn(n, ' > ', m);
    end;
    
    // also enumerative types can be ordered
    if huge > medium then
    begin
        writeLn('huge is greater than medium');
    end;
    
    // but the constants true and false are also comparable
    if true > false then
    begin
        writeLn('true is greater than false');
    end;
    
    // characters stay in a relation to each other, too
    // (result depends on the used character set)
    c := 'a';
    d := 'Z';
    
    if c > d then
    begin
        writeLn(c, ' > ', d);
    end;
end.

All ordinal types can be compared to values of the same type. Integers can be compared to any integer.

pascal
program comparisonSignedDemo(input, output, stderr);

var
    n: int64;
    m: qword;

begin
    n := -1; // n stored as %111...111
    m :=  2; // m stored as %000...010
    
    // signed comparison
    if n > m then
    begin
        writeLn(n, ' > ', m);
    end;
    
    // "unsigned" comparison
    if qword(n) > m then
    begin
        writeLn('qword(', n, ') > ', m);
    end;
end.

greater than or equal to

If the greater than symbol is followed by an equal sign >=, the comparison also results in true if both operands are equal to each other.

bit shift operator

Two consecutive greater-than signs >> act as the shr operator.

template list

In generic type definitions the template list is delimited by a closing >.


From the Free Pascal wiki, page "Greater than", 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 .

Edited on wiki.freepascal.org by 6 people, 2006–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
Rfc1394
Swen (minor)
Dejvid
Djzepi
Djzepi
Djzepi
E-ric (minor)
E-ric (minor)
Djzepi
Kai Burghardt
Kai Burghardtbit shift operator: link Shr (minor)
Djzepi
Kai BurghardtUndo revision 120680 by Djzepi (talk): remove unverified claim
Djzepi
Kai Burghardtresolve Category: Pages using deprecated enclose attributes (minor)

Talk about this page

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