All around NAV dev and test
Have a look at these code samples and tell me where a compound statement, i.e. BEGIN-END, should be constructed to get the code work right.
Just dare without going into NAV and verify.
For reference I have added numbers to each code line. Please use it as follows: if in case in Sample 2 the BEGIN should be added to line 2 and it's balancing END to line 4, you could suffice with writing Sample 2 - line2/line4.
Writing without looking into NAV Dev Env :)
Sample 1 (will compile):
3. ... BEGIN
Sample 2 (will not compile):
1. ... BEGIN
6. END ...
Sample 3 (not sure about compiling):
5. ... BEGIN
Sample 4 (not sure about compiling):
16. ... BEGIN
Sample 5 (will compile):
no changes needed?
Sample 1: 3a. BEGIN, 8. END;
Sample 2: 1a. BEGIN, 5. ;, 5a. END;
Sample 3: 5a. BEGIN, 7a. END;
Sample 4: no change - indentation on 16 and 17 could be better
Sample 5: no change
slightly different than AntidotE's...
with best regards
Hi Luc, this blog is the best argument to always and ever using BEGIN/END. Thank you very much!
Have to admit you're right, even though I am not found of "ever using BEGIN/END". ;-)
I guess you are not going to try to answer? 8-)