View Single Post
Old 12-14-2014, 10:54 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Try this. Sorry it's a little bulky, I have tried to comment the more obtuse bits.

Code:
program:

# if either is empty, return zero for reviews
r = test(
	field('#chapters'),
	ifempty(
		field('#reviews'),
		'0'
	),
	'0'
);
# don't divide by zero.
c = ifempty(
	field('#chapters'),
	'1'
);

ans = divide(r,c); 

cmp(
	ans,
	0,
# if zero return blank
	'',
	'',
	ans
)

Last edited by eschwartz; 12-15-2014 at 10:55 AM. Reason: fix typo with quoting field
eschwartz is offline   Reply With Quote