View Single Post
Old 01-13-2022, 02:42 AM   #283
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks

I came across some strange behaviour with a new template (ignore the wonky indenting, I removed a lot of other if-thens):

Code:
program:
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
newpercent = round(multiply ((f / s), 100));
 
					if newpercent < 99 then newpercent 
						else 98
					fi

Basically:

Divide F by S. Multiply it by 100. Round it to the nearest digit. If the number less than 99, use the new number; otherwise set it to 98.

But on line 6 if I add a '#' to if newpercent < #98 for the numeric comparison I get this error:

Code:
EXCEPTION:  Formatter: Failed to scan program. Invalid input '#99 then newpercent \n\t\t\t\t\t\telse 98\n\t\t\t\t\tfi' near the end of the program
It works fine if I use it without the #. Did I make a syntax mistake?

EDIT: I misplaced a space. It should've been <# not < #.

Last edited by ownedbycats; 01-13-2022 at 03:10 AM.
ownedbycats is offline   Reply With Quote