View Single Post
Old 06-17-2023, 05:35 PM   #636
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Hello! Does switch_if have a [pattern, value] limit? When I tried to add over 20 pairs, it started returning the first value even if it was false.

This worked (it has 20 pairs):
Code:
count = raw_field('#chapters');

chapters_count = switch_if(count>=95, 95, count>=90, 90, count>=85, 85, count>=80, 80, count>=75, 75, count>=70, 70, count>=65, 65, count>=60, 60, count>=55, 55, count>=50, 50, count>=45, 45, count>=40, 40, count>=35, 35, count>=30, 30, count>=25, 25, count>=20, 20, count>=15, 15, count>=10, 10, count>=5, 5, count>=1, 1, 0);
This didn't (it has 21 pairs):
Code:
count = raw_field('#chapters');

chapters_count = switch_if(count>=100, 100, count>=95, 95, count>=90, 90, count>=85, 85, count>=80, 80, count>=75, 75, count>=70, 70, count>=65, 65, count>=60, 60, count>=55, 55, count>=50, 50, count>=45, 45, count>=40, 40, count>=35, 35, count>=30, 30, count>=25, 25, count>=20, 20, count>=15, 15, count>=10, 10, count>=5, 5, count>=1, 1, 0);
Or actually, it did work when 'count' was '1', but only then.
estherflails is offline   Reply With Quote