Type Checking In Pascal
问题 I'm just wondering how it's possible to do type checking in pascal? I have been searching for hours now but I haven't been able to find anything useful. Example: var number: Integer; begin write('Enter a number: '); read(number); if {How am I supposed to check if 'number' is an Integer here?} then writeln(number) else writeln('Invalid input') end. 回答1: You are actually hitting the I/O type checking. You can work around this by disabling it temporarily and then checking the result: {$I-} /