From the Classic Client, click on the Help menu and select 'C/SIDE Reference Guide'. In the Search tab, enter 'EXIT' and click the "list topics" button. There's a whole list of topics that you can read that explains the various C/AL commands, and EXIT is in there somewhere.
Its a function that will exit either a true or a false variable.
Doesn't look like you really read it to me.
EXIT is the command that you use to jump out of a function, and between the parentheses you define the value of the return value. In this particular case, the return value is a boolean, so it is TRUE or FALSE. You can define any data type in the return value, and EXIT with any value that belongs to that data type. If you don't define a return value, you simply say EXIT without a parameter.
So if your return value is a text data type, you can say EXIT('Bye Bye'), if it is a decimal you can say EXIT(3.14), etcetera.
Read the C/SIDE Reference Guide again. Open up some big codeunits and search for the EXIT command and see how it's used in the standard code. By doing this, you might actually learn something.
Strange to say but EXIT is not listed in the online Help (NAV2009 SP1) and it has nothing in the Search option except a lot of entries with exit (in lowercase).
Thanks to Denster, we have a detailed explanation.
Experience is what you get when you hoped to get money
You must be in the code of an object when you go to help.
Here it is:
EXIT Statement
The EXIT statement is used to control the flow of the execution. The following syntax shows an EXIT statement.
Copy Code
EXIT([<Value>])
An EXIT statement is used to interrupt the execution of a C/AL trigger. The interruption takes place even when the code is executed inside a loop or a similar structure. The EXIT statement is also used when a local function should return a value.
Using EXIT without a parameter in a local function corresponds to using the parameter value 0. The C/AL function will return the value 0 or '' (empty string).
A compile-time error occurs if EXIT is called with a return parameter from either of the following:
System-defined triggers
Local functions that do not return a value
Example
The following example shows the use of the EXIT statement in a local function. Assume that the IF statement is used to detect an error. If the error condition is met, then execution is stopped and the local function returns the error code 1.
Copy Code
FOR I := 1 TO 1000 DO BEGIN
IF Amount < Total THEN
EXIT(1);
A := Amount + Total;
END;
EXIT is not listed in the online Help (NAV2009 SP1) and it has nothing in the Search option except a lot of entries with exit (in lowercase).
That's why I mentioned the C/SIDE Reference Guide, not F1 help or online help. From the Classic Client, click the Help menu and select 'C/SIDE Reference Guide'. You're right, if you enter 'EXIT' in the search, there's not a separate entry for EXIT, but just clicking down the list and reading through the stuff that DOES come up, you will get to it eventually.
I never said it was easy to find but the C/SIDE Reference Guide is a gem that surprisingly many people never use.
Comments
RIS Plus, LLC
Its a function that will exit either a true or a false variable.
But how to know when it should exit with TRUE or FALSE values.
This is my question.
This is a standard code on Classic:
IF ApprovalTemplate.FIND('-') THEN
EXIT(TRUE)
ELSE
EXIT(FALSE);
Lets say if the boolean return variable has been interchanged.
Thanks to clarify me.
Liizz
If record found then it is returning boolean TRUE
if not found FALSE
based on the return value from function the process may be different..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
If it was written
it would make more sense to read.
EXIT is the command that you use to jump out of a function, and between the parentheses you define the value of the return value. In this particular case, the return value is a boolean, so it is TRUE or FALSE. You can define any data type in the return value, and EXIT with any value that belongs to that data type. If you don't define a return value, you simply say EXIT without a parameter.
So if your return value is a text data type, you can say EXIT('Bye Bye'), if it is a decimal you can say EXIT(3.14), etcetera.
Read the C/SIDE Reference Guide again. Open up some big codeunits and search for the EXIT command and see how it's used in the standard code. By doing this, you might actually learn something.
RIS Plus, LLC
Thanks to Denster, we have a detailed explanation.
Here it is:
KCP Consultores
After scrolling down through to the end, I found the same text as you describe.
The FOR WHILE REPEAT help is in the first section of help text, so it is not that obvious.
I never said it was easy to find but the C/SIDE Reference Guide is a gem that surprisingly many people never use.
RIS Plus, LLC
http://www.BiloBeauty.com
http://www.autismspeaks.org