View Single Post
Old 02-08-2023, 01:45 PM   #507
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,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Thanks

New question.

Code:
program:

	if
		list_count($#fanficcat, ',') == 3
		&& 'Crossover' in $#fanficcat 
		&&	
		('Mass Effect Trilogy' in $#fanficcat && 'Mass Effect: Andromeda' in $#fanficcat)
		|| 
		('Half-Life' in $#fanficcat && 'Portal' in $#fanficcat)
		then
			'yes'
		fi
Three checks:

1. There are three items in the taglike #fanficcat.
2. One of them is 'Crossover.'
3. The other two are either "Mass Effect Trilogy, Mass Effect Andromeda" or "Half-Life, Portal."

Examples, to make it more clear:
Spoiler:

"Half-Life, Portal" - ✘ no match
"Crossover, Half-Life, Mass Effect Trilogy" - ✘ no match
"Crossover, Half-Life, Portal, zzz" - ✘ no match
"Crossover, Half-Life, Portal" - ✔ 'yes'


However, I messed up the operators as I'm getting 'yes' on a book where #fanficcat is "Half-Life, Portal" (two items and it does not include crossover). Where did I make the mistake?
|| is lower priority than && so the clause after the || stands alone. You must put parentheses around the pair of clauses in the ||.

I recommend you always use parentheses to ensure that clauses are grouped how you want.
chaley is offline   Reply With Quote