Omitting "else" from an if statement
Hi all,
Please close this issue if this is already possible - it doesn't seem to work currently
When using an if statement, an else block must be present
foo myarg:
echo {{ if myarg != "" { "myarg is present" } else { "" } }}
Would it be possible to default to "" is an else block is omitted?
foo myarg:
echo {{ if myarg != "" { "myarg is present" } }}
Thanks!
I think this is probably reasonable. I don't really like defaulting to "", it just seems inelegant, but I don't see a better alternative.
I'm taking a look at this issue because it looks relatively simple to implement, where exactly is the implementation for conditionals?
It's in a few places, but you can start with Parser::parse_conditional, and make Expression::Conditional::otherwise an Option.