The difference between exit, break, continue and other actions in Delphi

Source: Internet
Author: User

Delphi indicates that there are break,continue,abort,exit,halt,runerror, etc.

1.break

Force the exit of the most recent loop (note: It can only be placed in a loop, and it can only jump out of the last layer of the loop ), and is used to force exit from the for, while, repeat statements

Functionality similar to break in languages such as C + +

2.continue

For this processing in the end loop from the for, while, repeat statement, continue execution from the beginning of the loop body

Features similar to continue in languages such as C + +

3.exit

Used to exit from the current code block.

If the code is the main program, terminate the program.

If it is a function or procedure, immediately terminates the function or procedure

4.abort

Termination of the program required to run, generating non-error exception information. Jump out of the ancestor module. And the difference between exit is

Procedure P1;begin    p2;    P3;end;procedure p2;begin    abort;    or exit;end;procedure p3;begin    //perform some operation end;

In the execution of P1, if P2 inside with abort, then do not P3

If you use Exit, you can execute to P3, because exit can only control the function or procedure that terminates it, and cannot terminate the block of code that invokes its function. If you use Exit to terminate the function that it is in, it will jump back to the code block of the function and proceed with the execution of the code.

5.halt

Used to forcibly terminate the execution of an application, returning the operating system (non-normal exit mode)

6.runerror

Terminates execution of the program and produces a run error (return error code)

The difference between exit, break, continue and other actions in Delphi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.