Length Check
Entered data is only valid if it contains the correct number of characters. In the following example, the input must be repeated until a string of the required length is entered. The length function must be applied to a string and not to an integer or to a real number.
program LengthCheck; {$APPTYPE CONSOLE} uses SysUtils; var Code : string; begin repeat write('Please enter the 6 character product code. '); readln(Code); until length(Code) = 6; writeln(Code, ' is the correct length.'); readln; end.