Book Image

Programming Microsoft Dynamics NAV 2015

Book Image

Programming Microsoft Dynamics NAV 2015

Overview of this book

Table of Contents (19 chapters)
Programming Microsoft Dynamics™ NAV 2015
Credits
Foreword
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Flow control


Process flow control functions are the functions that execute the decision making and resultant logic branches in executable code. IF–THEN-ELSE, discussed in Chapter 6, Introduction to C/SIDE and C/AL, is also a member of this class of functions. Here we will discuss the following:

  • REPEAT-UNTIL

  • WHILE-DO

  • FOR-TO and FOR-DOWNTO

  • CASE-ELSE

  • WITH-DO

  • QUIT, BREAK, EXIT, and SKIP

REPEAT-UNTIL

REPEAT–UNTIL allows us to create a repetitive code loop which REPEATs a block of code UNTIL a specific conditional expression evaluates to TRUE. In that sense, REPEAT–UNTIL defines a block of code, operating somewhat like the BEGIN–END compound statement structure which we covered in Chapter 6, Introduction to C/SIDE and C/AL. REPEAT tells the system to keep reprocessing the block of code, while UNTIL serves as the exit doorman, checking if the conditions for ending the processing are true. Because the exit condition is not evaluated until the end of the loop, a REPEAT–UNTIL structure will...