View Single Post
Old 09-03-2020, 02:05 PM   #1
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Template if -- then -- else

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 break something. For example, having variables named "if" will probably break things. The question is "Will people use it?" Thanks

Last edited by chaley; 09-06-2020 at 09:16 AM. Reason: Grammar
chaley is offline   Reply With Quote