How to avoid printing result of IF condition in user macro


I’m writing user-macro for confluence server and I’m using a few lists in it.
I check each element of the first list and if it meets the condition I add the element in another list.
Later in the code I’m using the $listTwo for the main functionality of the macro and gives the expected result. The problem is that when I export in pdf given page it prints the expected results of the macro but it also prints “true” every time when IF condition returns true. How can I avoid this?
This is that part of the code

#foreach( $x in $listOne )
#set( $xChilds = $x.getChildren())
#if ($xChilds.size() >0)

#set($x = $listTwo.add($xChilds))

Thanks @MatteoGubelliniSoftC

Instead of #set($x = $listTwo.add($xChilds)) I put
#set($p = $listTwo.add($xChilds)) because x was already mention in the for loop.

Sure you can use any variable name rather than x. It will just store the true/false result.


1 Like