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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.10.2012, 17:04   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006


Read with me what the Microsoft Dynamics NAV 2009 Developer and IT Pro Documentation phrases on BEGIN/END, i.e. compound, statement:

In some cases, the C/AL syntax only allows you to use a single statement. If however you have to execute more than one simple statement, the statements can be written as a compound statement by enclosing the statements between the BEGIN and END keywords.

Typically these cases can be:
So, as the quoted sentence states, the compound statement is applied when more then one statement is needed where the structure of the conditional, repetitive or WITH statement expects - or should I say: allows - only a single statement. Note that there is no explicit mentioning that you should use the compound statement, i.e. en-wrapping BEGIN/END, only in case of multiple statements. However, looking at the standard application, it has been the intention that this is part of the best practices. In spite of what others might argue - see for example this post: IF Without BEGIN and END Considered Harmful.

Comparing NAV 2013 Beta en NAV 2013 RTM I dare to assert that this best practice has been affirmed as many redundant BEGIN/END wrappers have been cleared out of the code. With many I mean many. I am not sure enough to say all.

See some examples in the screen shot.




Notes
  • Was it coincidence that around the time RTM could be downloaded the blog post IF Without BEGIN and END Considered Harmful was published?
  • Which repetitive statement does not need a compound statement?
  • Of course it was somewhat strange to see NAV Team developers violate this best practice in their example code at NAV TechDays 2012


Читать дальше
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:23.