Search
 
SCRIPT & CODE EXAMPLE
 

PASCAL

pascal input format check

Program TRY_EXCEPT_STATEMENT;
{$mode delphi}
uses crt,sysutils;

var
num:integer;
run:boolean;

begin 
    Writeln;
    run:=TRUE;
    
    While run do
    begin
        try    {if anything goes wrong in code, the program will move on to except}
           write('Enter an integer here please: ');
           readln(num);
           writeln('VALID INPUT');
           run := FALSE;
        except	{The program instead of crushing, does the following code} 
           writeln('WRONG INPUT - PLEASE TRY AGAIN');
           run := TRUE;
        end;
    end;
    
    Writeln;
end.

{ 
Program Description:
  Program gets input from the user and performs 
  a format validation check using the try-except 
  statement. The program will ask for input
  until the input entered is valid.
}
Comment

PREVIOUS NEXT
Code Example
Pascal :: wait in pascal 
Pascal :: while loop in pascal 
Pascal :: function in pascal 
Pascal :: Pascal (fpc 3.0.4) sample 
Powershell :: CMD & Powershell History 
Powershell :: call function powershell 
Powershell :: change increase windows scroll bar slider width 
Gdscript :: godot find_node() 
Clojure :: hello world in clojure 
Abap :: abap integer 
Cobol :: python pygments install 
Assembly :: sqlalchemy filter date today 
Assembly :: resize pdf file 
Assembly :: html drag and drop anywhere 
Assembly :: how to custom style material ui 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: jquery add disabled to button 
Javascript :: jquery run code after 5 seconds 
Javascript :: use jquery 
Javascript :: vimeo playback speed 
Javascript :: Basic JavaScript: Use Recursion to Create a Range of Numbers 
Javascript :: vuex-module-decorators rawError globally 
Javascript :: autoplay owl carousel 
Javascript :: how to get element by title js 
Javascript :: check ip json 
Javascript :: shadow elevation react native 
Javascript :: javascript capitalize string 
Javascript :: remove all options from select jquery 
Javascript :: swiper.js cdn 
Javascript :: angular go to route 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =