Do you know C/AL "continue" method?

GRUBBYFANS
Member Posts: 154
today, I am writing code,I found a question ,
for example:
i integer
for i:=1 to 3 do begin
if i=2 then
continue??here is error
end
so please tell me in C/AL replace "continue" the method,it is like "skip" method
I d'like to skip this circle,not like "break",so give me a idea,thanks
for example:
i integer
for i:=1 to 3 do begin
if i=2 then
continue??here is error
end
so please tell me in C/AL replace "continue" the method,it is like "skip" method
I d'like to skip this circle,not like "break",so give me a idea,thanks
0
Answers
-
You are going to be looping in the i := 1 to 3, with each loop its incrementing... I'm not sure if I'm understanding this right, but if you want to ignore two then you can always do:
IF i <> 2 THEN BEGIN //some code here END;
and do the part you wanted to do for 1 and 3 within that section.
SKIP is used to skip a record in fashion of CurrReport.SKIP, or DataPort.SKIP, etc... Since you are doing i := 1 TO 3, its going to go through 1, 2, and 3 no matter what, that's what its being told to do.
What exactly are you trying to do with it so we can better help and understand it?
Kevin-Lavin
"Profanity is the one language all programmers know best."0 -
klavin wrote:You are going to be looping in the i := 1 to 3, with each loop its incrementing... I'm not sure if I'm understanding this right, but if you want to ignore two then you can always do:
IF i <> 2 THEN BEGIN //some code here END;
and do the part you wanted to do for 1 and 3 within that section.
SKIP is used to skip a record in fashion of CurrReport.SKIP, or DataPort.SKIP, etc... Since you are doing i := 1 TO 3, its going to go through 1, 2, and 3 no matter what, that's what its being told to do.
What exactly are you trying to do with it so we can better help and understand it?
Kevin0 -
You answered your own question:GRUBBYFANS wrote:there isn't the method in Navision0
-
Not sure If I'm following but how I read the question you could use a confirm no???
if 1 then do something
if 2 then confirm (would you like to go to 3 or would you like to do something else)
I might be right on or way off0 -
Savatage wrote:Not sure If I'm following but how I read the question you could use a confirm no???
if 1 then do something
if 2 then confirm (would you like to go to 3 or would you like to do something else)
I might be right on or way off
Not sure you explained well because if i = 1 to 3 it will always hit 2 what do you want to skip.
these vague theoretical hypotheticals give me a headache-ical0 -
I should read the original question more carefully :oops: . You could do something like this:
i := 0; // i is an integer ContinueProcessing := TRUE; // ContinueProcessing is a boolean REPEAT i := i + 1; ContinueProcessing := CONFIRM('i equals ' + FORMAT(i) + '. Do you want to continue?',TRUE);; UNTIL (i = 10) OR (ContinueProcessing = FALSE);
As long as you hit the Yes button it shold keep looping, and jump out when you click no. Put this code in a button on a test form and see what happens. I haven't tested the code yet so you might need to play around with it a little bit.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions