Recursively:

Code:

Function unbitwise($x)
dim $c
$c = 1
while $c*2 <= $x
$c = $c*2
loop
if $x-$c >0
$unbitwise = "" + $c + "," + unbitwise($x-$c)
else
$unbitwise = $c
endif
endfunction



For recursive functions, you want to have some sort of base condition, that when passed means you are done with the recursion. Usually it's in the beginning of the function, but for this particular one, it's at the end. If $x-$c = 0, I'm done with the recursion and just return $c.
_________________________
Eric