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 :: pascal pause program for seconds 
Pascal :: while do in pascal 
Pascal :: pascal online compiler 
Pascal :: pascal area 
Powershell :: powershell display firewall rules name 
Powershell :: How to display firewall rule ports with powershell 
Powershell :: powershell show which diorecty is temp 
Gdscript :: godot check left mouse button 
Clojure :: how to make a range clojure 
Abap :: abap alv popup 
Cobol :: alertDialog with textfield validator flutter 
Assembly :: jinja loop index 
Assembly :: vba check if shape name exists 
Assembly :: assembly language display message 
Assembly :: google appscripts cell get background color 
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+8 =