COMPARISON OF CHARACTER VARIABLES
Character variables, when compared against each other, is done
using the ASCII value of the character. Consider the following
portion of code,
var letter1, letter2 : char; begin letter1 := 'A'; letter2 := 'C'; if letter1 < letter2 then writeln( letter1, ' is less than ',letter2 ) else writeln( letter2, ' is less than ',letter1 ) end.
STRING ARRAYS, COMPARISON OF
Packed character arrays of the same length are comparable. There
follows a short program illustrating this,
program PACKED_CHAR_COMPARISON (output); type string1 = packed array [1..6] of char; var letter1, letter2 : string1; begin letter1 := 'Hello '; letter2 := 'HellO '; if letter1 < letter2 then writeln( letter1,' is less than ',letter2) else writeln( letter2,' is less than ',letter1) end.