Search
 
SCRIPT & CODE EXAMPLE
 

PASCAL

pascal try catch finally

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 :: delay() in Pascal 
Pascal :: pascal iteration 
Pascal :: for loop pascal 
Pascal :: does not equal in pascal 
Pascal :: pascal cheat sheett 
Powershell :: powershell remove node_modules 
Powershell :: How to download jira attachments using curl 
Gdscript :: godot progrssbar set max value in code 
Gdscript :: godot print enum name 
Abap :: abap concatenate 
Lisp :: common lisp map number to word 
Assembly :: json vulnerabilities 
Assembly :: wstring to lpcwstr 
Assembly :: stick with it no download 
Assembly :: tqdm iterate over range 
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
1+2 =