Quit, Break, SKIP, EXIT

One of my student asked the following question few days back and I just tried to answer them in simple language. You may already know those answer right.

“can u please tell me the diff. in quit/break/skip/exit in NAV & how to use it properly……..”

Just to answer your question –

1. Quit 

Quit can only be used in Report, Dataport or XMLport. (Like Currreport.quit). It quits (come out from) the report or dataport or XMLPORT. If some processing of data happened before the quit statement, all of those data manipulations will be reversed (rolled back).

2. Break

Break can be used in 2 places –

a. in any loop (repeat..until) – This statement will break the loop and come out of the loop without further processing. All the data manipulation before this statement will remain intact.

b. In a report or dataport or XMLport. This statement will take you out from any trigger (like on prereport, Onpresection etc)

3. SKIP 

SKIP is only used in Report / Dataport / XMLPORT. This statement skips the iteration of a dataitem.

4. EXIT

EXIT normally used in functions / triggers to return a value. (say a function returns a numeric value –

Myfunction(integer A, Integer B) Integer—

EXIT(A+B);

————————————————-

Hope the above answer helps you. I will try to send a more detailed answer to you (with example) soon. Keep writing me your problems and ask ur freinds to send their problems to me too.


You can also send me a mail to snehanshu.mandal@gmail.com

3 Replies to “Quit, Break, SKIP, EXIT”

    1. Hi Snehanshu,

      Simple and clear explanation on Quit, Break, SKIP, EXIT.

      However, regarding BREAK: until NAV 2016 this is not fully true as “in any loop will” does only apply to Dataport, Report or XMLport, unfortunately.

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.