Limitation on Nested IF THEN ELSE statement in NAV 2016


Interesting observation related to NAV 2016:

Seems there is limitation on Nested IF THEN ELSE statement, you can do upto 35 cases and if done on 36th case then NAV crashes while compiling the object.

Although there was no such limitation upto NAV 2015. I know one should use CASE OF statement in such scenarios, but this issue initially appeared little weird.

Did anyone else also faced this issue and is it documented FEATURE in NAV 2016?


Dhan Raj Bansal

Well, HOW did you found it out? Really have a piece of code containing 35+ nestings?

Some limit has (and must) have been there forever, compiler stack has it’s limits, but 35 levels should be enough, I can’t imagine reasonable code which runs over that high nesting levels [:O]

BTW NAV doesn’t have a compiler, it’s interpreter in fact. There were rumors about “Intermediate language” and C#, but what really happens inside there I have no way to find out. The changes may have been caused by this internal approach, but it’s not introduced in NAV2016, it was earlier.

You are nesting IF statements 35 levels down??? Don’t you think there’s something wrong with that?