View Single Post
Old 03-30-2023, 12:30 PM   #537
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,486
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
If it finds one unwanted identifier, it would then skip the rest. What should I use instead of if-thens?
If you want all the checks to be made then you should use a sequence of if-thens without the else. You would need to pass along the intermediate result.

NB: The template in #530 doesn't have the problem. For completeness, here is the version corrected for the error you mentioned in #531.
Code:
program:

	def do_one(ids, check_value, select_identifier):
		si = select(ids, select_identifier);
		if 
			!$#purchasesource==check_value && si
		then
			return list_difference (ids, strcat(select_identifier, si), ',')
		fi;
		return ids
	fed;

	ids = do_one($identifiers, "Amazon",'amazon');
	ids = do_one(ids, "Barnes & Noble", 'barnesnoble');
	ids = do_one(ids, "Kobo", 'kobo');
	ids = do_one(ids, "Baen", 'baen')
chaley is offline   Reply With Quote