[Oberon] A slightly better procedure
cym224 at gmail.com
Sat Dec 11 16:32:07 CET 2010
On 10 December 2010 20:59, Jan Verhoeven <jan at verhoeven272.nl> wrote (in part):
> which can be further improved to
> PROCEDURE IsDigit(ch: CHAR): BOOLEAN;
> RETURN (ch <= '9') & (ch >= '0')
> END IsDigit;
> since there are many more characters above '9' than below '0'.
A (minor) visual improvement is to write ('9' >= ch) & (ch >='0').
This assists in comprehension as you see the upper and lower bounds of
the interval at once. (I have known companies with this rule for
programming languages and it works well.)
More information about the Oberon