Search
 
SCRIPT & CODE EXAMPLE
 

PASCAL

pascal exception handling

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 :: pascal sleep 
Pascal :: pascal while 
Pascal :: array pascal 
Pascal :: case of pascal 
Powershell :: disable defender powershell 
Powershell :: install python command line windows 
Powershell :: To Show wifi profiles stored on a windows computer 
Gdscript :: godot ignore function 
Gdscript :: godot saving enum names in variable 
Abap :: abap shortcut comments 
Cobol :: google apps script remove nulls array 
Assembly :: press button on enter 
Assembly :: how to check if chat is nsfw discord.py 
Assembly :: spliting dateetimeindedx into date and time column 
Assembly :: discord.py change status to invisible 
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
2+7 =