I’m trying to create a random message what the weather will be during school hours.
I could make it easy for me and just use the word precipitation, but since it’s for the kids rain and snow is perhaps better.
So if temperature is > 0 degrees rain else snow.
The issue is how can I do this in the middle of a sentence?
{{ [
"The forecast says there will be no " ~ "rain." if ns.tmax > 0 else "snow.",
"Today there will be no " ~ "rain" if ns.tmax > 0 else "snow" ~ " during school time."
] | random
}}
The first one works as expected but the second one only adds " during school time."
if it’s snowing, which is what I have done, but how can I add the end if there and make sure it adds the last string even if it’s no rain?
Just as I typed this message I thought of using replace. So I use precipitation as the string word and replace it with snow or rain.
But I would rather have it without the replace if that is possible.