Just stumbled over that:

--- cut ---

#set ($a = 0)
#set ($b = 1)

#set ($c = $a and $b)
#set ($d = $a or $b)

A: $a
B: $b
C: $c
D: $d

Rendering this template gives a bit of a surprising result:

A: 0
B: 1
C: true
D: true

While the behaviour is obvious (anything not-null is true in Velocity
expressions), it is still sort of a "gotcha". Personally I'd like to
see this behaviour changed (number '0' or the empty String '' get
converted to "false") because then it would match the expression
system of well known languages like perl or php(?).

Any opinions on that?

        Best regards
                Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

Social behaviour: Bavarians can be extremely egalitarian and folksy.
                                    -- http://en.wikipedia.org/wiki/Bavaria
Most Franconians do not like to be called Bavarians.
                                    -- http://en.wikipedia.org/wiki/Franconia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to