View Single Post
Old 09-24-2023, 04:15 PM   #653
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,529
Karma: 8075938
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Is there any functional difference between $$#timesread>#0 or $$#timesread>=#1?

Code:
program:
	status = readstatus();
	times = $$#timesread;

	switch_if(
		status=='currentlyreading' && times>#0, 'Currently Rereading',
		status=='currentlyreading', 'Currently Reading',
		status=='toberead' && times>#0, 'To Be Reread',
		status=='toberead', 'To Be Read',
		status=='read', 'Read',
		status=='unread', 'Unread',
		status=='didnotfinish', 'Did Not Finish',
		''
	)
No difference in meaning or performance. There are usually multiple ways to express a relational conditional. Often one of them makes more sense to a reader. In your case, to me ">#0" better expresses the logic.

You could even do
Code:
! $$#timesread<=#0
chaley is offline   Reply With Quote