If it's in braces it is treated as an expression to be parsed, if it is outside 
of braces it is treated as a string.  So 
        <if test="${6000 != 5}" />

would be treated as an expression and correctly evaluated, but

        <if test="6000 != 5" />

would result in an error.  Values assigned to a variable are generally treated 
as strings, so they must be parsed before you can compare them to properly 
typed values such as numbers.  The online help covers the subject in depth:

        
http://nant.sourceforge.net/release/latest/help/fundamentals/expressions.html
        

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen
Tunney
Sent: Monday, January 09, 2006 5:36 PM
To: [email protected]
Subject: RE: [NAnt-users] Integer value comparisons


I understand what you are doing here, but the line still seems
unreadable (compared to the bool::parse method I just found and posted a
moment ago).

Why would the evaluation need to be inside of the curly braces?

NAnt team, does this mean that I can do the following and it will
evaluate an expression?

<if test="${6000 != 5}" />

If so, why the need for the "${}" at all?

Stephen Tunney, MCAD.NET

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Evans,
Jonathan (2)
Sent: January 9, 2006 12:25 PM
To: [email protected]
Subject: RE: [NAnt-users] Integer value comparisons


<if test="${long::parse(x)} != 0">

should be:

<if test="${long::parse(x) != 0}">
                               ^
                               |

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen
Tunney
Sent: Monday, January 09, 2006 5:19 PM
To: [email protected]
Subject: [NAnt-users] Integer value comparisons


Hello All,

Having trouble with the basics again :).

Was wondering how someone would go about expressing the following

Psuedo Code:
{
        Variable x := 500  //Value can be anything, returned from an
exec call

        If x != 100 then fail
}

I've tried the following and if fails

<property name="x" value="500" />

<if test="${long::parse(x)} != 0">
        <fail message="Aborting." />
</if>

And it complains that
'603 != 0' is not a valid value for attribute 'test' of <if ... />
Cannot resolve '603 != 0' to boolean value.
String was not recognized as a valid Boolean.

Little help? :(

Stephen Tunney, MCAD.NET


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

========================================================================
======
Please access the attached hyperlink for an important electronic
communications disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

========================================================================
======



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users


This Message Scanned for Viruses by McAfee WebShield .



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

==============================================================================
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

==============================================================================



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to