4 ms·
I have learnt that you can throw in parentheses for readability.. if (or cond1 cond2)
by kaushalmodi 9y ago
I have learnt that you can throw in parentheses for readability..
if (or cond1 cond2)
- cmsd2 9y agoThe next logical step is to mark with parentheses the two branches of the if expression: (if (or cond1 cond2) (then) (else)) although i suppose it's not really hugo anymore..
- seanwilson 9y agoIs there a reason something more standard like "if cond1 or cond2 then x else y" isn't supported? Parsing speed?
- kaushalmodi 9y agoGoing along with the joke, that's almost how elisp (most of the other lisps too, I believe) works: (if (or cond1 .. condn) (progn (true1) (true2)) (false1) (false2)) But in Go templates, it would be: {{ if (or cond1 .. condn) }} true1 true2 {{ else }} false1 false2 {{ endif }}