IF... Then... ELSEIF... Then... ELSEIF... etc

Anyone know if there’s an upper limit to this nesting? How many times?

$ If ? then :$$ elseif ? then :$$ elseif ? then :$$ elseif ? then… and so on… :last value$

I’ve done it 7 times deep for day-of-week language changes on the #DOW# here in French:


$#DOW#=0?Dimanche:$$#DOW#=1?Lundi:$$#DOW#=2?Mardi:$$#DOW#=3?Mercredi:$$#DOW#=4?Jeudi:$$#DOW#=5?Vendredi:$$#DOW#=6?Samedi:$

And here in German:


$#DOW#=0?Sonntag:$$#DOW#=1?Montag:$$#DOW#=2?Dienstag:$$#DOW#=3?Mittwoch:$$#DOW#=4?Donnerstag:$$#DOW#=5?Freitag:$$#DOW#=6?Samstag:$

Thanks,
John

1

Currently, Facer doesn’t support nesting conditions inside of other conditions.

It might work in the editor, but that’s because it runs on a different OS.

Thanks Mellin. I was trying the sunrise/sunset stuff that’s been trendy here lately…

$ if (between sunset&sunrise) ? (do something B) :$$ else if (within the sunrise hour) ? (do something C) :$$ elseif (within the sunset hour) ? (do something D) : (otherwise it’s just daytime do the default something A) $

It’s firing the first do something B and the last default something A as I move the time machine but ignoring the middle B and C actions.

…bummer

When I first started with animations, that was my first thought as well. The only work around is using multiple elements and transparencies. Similar to the issue with trying to calculate the +1/-1 dates. I think @Mellin got to 21 elements to correctly display those two values alone. Good luck doing +2/+1/0/-1/-2.

If you’re looking for +2/+1/-1/-2 codes, then check out my Magnifying Glass series:

When it comes to working codes for dates, check this topic: Date plus and minus 1 day
It uses 14 elements.

1 Like

I came across this thread when searching for something on expressions. I have nothing to add to this topic, but I wanted to say that the Magnifying Glass - Steampunk face is wicked awesome! I really like your work Mellin.

Absolutely great watch face! I like!