Re: default value for boolean

Leos Literak <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
According to documentation this will test variable existence, not its value:

"This operator tells if a value is missing or not. Depending on that, 
the result is either true or false."

But I want to test value of the variable, which might be missing.
See my fix I had to do:

<#if EDIT_MODE!> 	

was replaced by

<#if EDIT_MODE!false>

The original code was

<#if EDIT_MODE?if_exists> 	

Leos

Jonathan Revusky napsal(a):
> You need <#if var??>....</#if>
> 
> On Thu, Jan 29, 2009 at 4:59 PM, Leos Literak <[email protected]> wrote:
>> Hi all,
>>
>> I've started to get rid off old ?if_exists and globally replaced it with
>>  ! operator. But it does not work in <#if, freemarker complains that it
>> does not evaluate to boolean. I don't remember that old debate when
>> these new directives were being introduced. But currently I find it
>> confusing, that ! does not evaluate to false. Why do we decided
>> implement it this way?


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.