You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by wg...@apache.org on 2005/09/12 00:08:00 UTC
svn commit: r280187 - /jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml
Author: wglass
Date: Sun Sep 11 15:07:57 2005
New Revision: 280187
URL: http://svn.apache.org/viewcvs?rev=280187&view=rev
Log:
included info on text operators and #{else}
Modified:
jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml
Modified: jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml
URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml?rev=280187&r1=280186&r2=280187&view=diff
==============================================================================
--- jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml (original)
+++ jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Sun Sep 11 15:07:57 2005
@@ -1135,6 +1135,11 @@
#end
]]></source>
+ <p>Note that the semantics of <em>==</em> are slightly different than Java where <em>==</em>
+ can only be used to test object equality. In Velocity the equivalent operator
+ can be used to directly compare numbers, strings, or objects.
+ </p>
+
<p>
Velocity has logical AND, OR and NOT operators as well.
For further information, please see the
@@ -1144,7 +1149,6 @@
</p>
<source><![CDATA[
-
## logical AND
#if( $foo && $bar )
@@ -1173,7 +1177,6 @@
</p>
<source><![CDATA[
-
## logical OR
#if( $foo || $bar )
@@ -1215,6 +1218,22 @@
which is something altogether different.
</p>
+ <p>There are text versions of all logical operators, including
+ <em>eq</em>, <em>ne</em>,
+ <em>and</em>, <em>or</em>, <em>not</em>, <em>gt</em>, <em>ge</em>, <em>lt</em>,
+ and <em>le</em>.
+ </p>
+
+ <p>One more useful note. When you wish to include text immediately following
+ a <em>#else</em> directive you will need to use curly brackets immediately surrounding
+ the directive to differentiate it from the following text.
+ (Any directive can be delimited by
+ curly brackets, although this is most useful for <em>#else</em>).
+ </p>
+
+<source><![CDATA[
+#if( $foo == $bar)it's true!#{else}it's not!#end</li>
+]]></source>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org