On 4/14/06, William Allen Simpson william.allen.simpson@gmail.com wrote:
I've never found adding a space before the colon at the end of a sentence fragment to be easier to read, either.
It's not just literal spaces, but *any* whitespace (carriage returns, tabs, etc). So you could do, for example:
{{#if :<string> |<then result> |<else result> }}
Note also that the result strings are also trimmed of whitespace, so the CR/LF are ignored.
So, it should be called "#ifdef:" to match ingrained expectations. Could "#if:" be quickly retired?
#if is shorter which is probably why it'll be kept as-is.
Also, "#ifexpr:" just showed up in the documentation today, so you'll forgive me for not knowing about it. And wouldn't we just use "#ifexpr: X = 0" otherwise?
I proposed it on the talk page a little while ago (which is where most discussion is going on right now). Yes, you could use #ifexpr as you describe I suppose. =) I was mostly thinking of situations where a template would return 1 or 0 for true or false (see [[en:Template:IsLeapYear]]).
"#ifeq:" is for matching strings, not against "0". See what I mean about ingrained expectations?
Everything is a string. You could use #ifeq or #ifexpr (though I suspect #ifeq would be faster as far as CPU resources are concerned).
-L