AXForum  
Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.05.2016, 18:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
vanvugt: BREXIT? Nope, BREAK EXIT
Источник: http://dynamicsuser.net/nav/b/vanvug...eak-lt-gt-exit
==============



Coming from a C/C++ world into NAV, ages ago, it was somewhat dismaying to feel the various constraints of the system. And true, to also feel the power of it, not in the least because of these constraints, IMHO. But hell, isn't this always the case when changing? I mean, when changing, whatever. Habits. Tools. On-premise to cloud. Your partner. Or we could be still in a honeymoon state of mind and find out the constraints later.

Well, long story short. One thing I was very surprised by was the BREAK statement in NAV. Probably I am wrong, but my head kept on saying: any programming language has a BREAK statement allowing to break out of the current loop (or switch) construction and continue just after it. And yes, NAV did have (and still has) a BREAK statement, but only within the Dataport, Report and XMLport objects.

And now, finally, after all these years [emotional sob], with NAV 2016, BREAK has become what-I-always-wanted-it-to-be, allowing me "... to break out of the current loop (or switch) construction and continue just after it."

Yesss!

And contrary to what the help topic title (still) seems to suggest BREAK Function (Report, XMLport), it is valid in any object now. Just try for example the following in a codeunit:

Window.OPEN('i = #1###');

FOR i :=1TO10DO BEGIN
Window.UPDATE(1,i);
SLEEP(
500);
IF i = 6 THEN
BREAK;
END;

Window.CLOSE

It works just fine.

Reading the help topic in detail don't let yourself be mislead:

no BREXIT, i.e. BREAK EXIT

Because contrary to what the remark in the topic says (notice my red coloring):

BREAK causes the current trigger to end. When used inside a loop, such as a WHILE-DO or REPEAT-UNTIL construction, BREAK interrupts the loop and causes the current trigger to end.

Nope, BREAK will just interrupt the loop and "continue just after it". To cause the current trigger to end we already have EXIT don't we?

Note

When you program a BREAK outside a loop the compiler will throw an error:

BREAK statement can only appear inside a loop (FOREACH, FOR, WHILE, REPEAT).






Источник: http://dynamicsuser.net/nav/b/vanvug...eak-lt-gt-exit
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Van Vugt: BREXIT? Nope, BREAK EXIT Blog bot Dynamics CRM: Blogs 0 05.03.2016 10:05
Van Vugt: BREXIT? Nope, BREAK EXIT Blog bot Dynamics CRM: Blogs 0 05.03.2016 10:05
NAV Team: Coffee Break – keeping stuff in the cloud Blog bot Dynamics CRM: Blogs 0 24.04.2015 15:00
kamalblogs: Dev Info: Beware not to use XML special symbols in attributes and break CIL compile Blog bot DAX Blogs 0 21.11.2013 00:12
Транслитерация русских букв в английские Poleax DAX: Программирование 2 03.07.2009 17:59

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:58.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.