Quote:
Originally Posted by ownedbycats
Here's what I came up with:
Code:
program:
## list_remove_duplicates probably isn't necessary
list = list_remove_duplicates($#fanficrating, ',');
first_non_empty(
if 'Explicit' inlist list then 'Explicit' fi,
if 'Mature Audiences' inlist list then "Mature Audiences" fi,
if "Teen and Up Audiences" inlist list then "Teen and Up Audiences" fi,
if "General Audiences" inlist list then "General Audiences" fi,
if "Not Rated" inlist list then "Not Rated" fi
)
|
That works well. If you haven't already done it, put the checks in probability order.
Note that what you wrote is exactly equivalent to this switch_if. I used the assignment to avoid writing the string twice. It isn't needed as the last test shows.
Code:
program:
## list_remove_duplicates probably isn't necessary
list = list_remove_duplicates($#fanficrating, ',');
switch_if(
(a = 'Explicit') inlist list, a,
(a = 'Mature Audiences') inlist list, a,
(a = "Teen and Up Audiences") inlist list, a,
(a = "General Audiences") inlist list, a,
"Not Rated" inlist list, "Not Rated",
''
)