When ^export^ code is evaluated, it inserts the necessary code into the output - or none - as pertinent. In the case of ^if()^ clauses this can lead to blank lines in the output source code as although the unmatched branch emits nothing, the line return after ^endIf^ is still emitted.
The trick is to place the line return inside the if clause. This is achieved by placing the ^endIf^ on the next line. Originally you might have had this:
^value($Name)^ ^if(ChildCount)^ There are ^value($ChildCount)^ children ^endIf^ ^text^
Which would either emit a blank source line before/after the number of children, or a blank lines if there are no children. To resolve this, use:
^value($Name)^ ^if(ChildCount)^There are ^value($ChildCount)^ children ^endIf^^text^
If using an ^else^ branch apply the same principle - i.e. ensure all line breaks belonging to the result of if clause are inside the if statement:
^value($Name)^ ^if(ChildCount)^There are ^value($ChildCount)^ children ^else^There are no children ^endIf^^text^
If source code is indented with tabs or spaces, don't forget the ^endIf^, precedes such indentation rather than coming before the first on-screen output.