Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50107

Template if -- then -- else

$
0
0
I am considering implementing classic if-then-else clauses in general program mode of the template language. They would look something like this, borrowed from Algol 68.
Code:

if func_or_var then
    series of statements;
[else
    series of statements;]
fi

(The else part is optional.) The test would be an expression in the current template language that returns either an empty value or not. One can imagine using field(...), first_non_empty(...), and/or(), and strcmp, but all the functions will be available. Only one of the "then" or "else" parts will be evaluated. I wouldn't try hard to make it work in template program mode.

This isn't trivial to implement and might breaking something. For example, having variables named "if" will probably break things. The question is "Will people use it?" Thanks

Viewing all articles
Browse latest Browse all 50107

Latest Images

Trending Articles



Latest Images