Delphi means jumping out of break,continue, Exit,abort, Halt, Runerror

Source: Internet
Author: User

1. Break forces the exit loop (which can only be placed in a loop) and is used to force exit from the for statement, while statement, or repeat statement.
2, continue
Used to forcibly end the loop of the call from the For statement, while statement, or repeat statement, and start the next loop.
3. Exit
Used to exit from the current code block. If the code is the main program, terminate the program, or the procedure or function immediately if it is a function or procedure.
4. Abort
Abort the operation of the program, resulting in 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

Exit

End

Procedure P3;

Begin

ShowMessage ().

End
If Abort is used, the P3 is not executed and can be executed to P3 if Exit is used.
5. Halt is used to forcibly terminate the execution of the application and return to the operating system (non-normal exit mode).

6. Runerror terminates the execution of the program and generates a run error (return error code).

=======================================

Break jumps out of the loop
Continue continue to the next loop
Abort throws an empty exception
Exit exits the current procedure.
Try to minimize the use of control language, because it is easy to make logical mistakes when combined with abnormal catching and subsequent modification.

========================================

Exit: Exit Function Body
Abort: Encounter exception, quiet processing, just do not show not prompt
Break: Exits the current loop body, including for, while,
Repeat and other circulating body
Continue: Ends this processing within the loop and continues execution from the beginning of the loop body

Exit
is to jump out of the current code block, which is the current function, and then go out and continue down (if there is a subsequent code).

Abort is coming from Eabort and can inspire
Exception, which is essentially Abort = RaiseException (), is an exception that does not appear in the dialog box. So Abort
Behaves like an exception, and its code execution order is also the process of follow exceptions.
For example:
Try
(1)//execute the
Abort
(2)
Do not execute
exception
(3)//execute the
End

Use Abort to execute exception
The code inside, but if you use Exit, go straight away, no matter
exception


Delphi indicates that there is break,exit,abort.
"Break"
Leave the Loop
Can only be placed in the loop

"Exit"

Jumping out of this module (procedure and function), in the loop, is the module that jumps out of the loop.

"Abort"
Abort the operation of the program, resulting in 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
Exit
End
Procedure P3;
Begin
ShowMessage ().
End
If you use
Abort, the P3 is not executed and can be executed to P3 if Exit is used.

=====================================

Delphi means jumping out of break,continue, Exit,abort, Halt, Runerror

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.