Hi Jacques

The shortcut ternary operator (?:) would work:
productTypeId = null;
if ("FINISHED_GOOD" == productTypeId ?: "FINISHED_GOOD")

Scott

2008/6/7 Jacques Le Roux <[EMAIL PROTECTED]>:

> Yes, it should I guess.
>
> BTW (and a bit OS) I don't think there is a default operator in Groovy like
> ! in freemarker
> http://freemarker.sourceforge.net/docs/dgui_template_exp.html#dgui_template_exp_missing_default
>
> Jacques
>
> From: "David E Jones" <[EMAIL PROTECTED]>
>
>
>> Does the groovy "?" operator thrown in different places solve this
>>  problem?
>>
>> It seems like it's kind of like the "?if_exists" in FTL, and may help
>>  with things like this.
>>
>> -David
>>
>>
>> On Jun 5, 2008, at 4:06 AM, Scott Gray wrote:
>>
>>  Hi Jacopo
>>>
>>> I just ran a quick test and Groovy seems to throw an error when an
>>> undeclared variable is used.
>>>
>>> Scott
>>>
>>> 2008/6/5 Jacopo Cappellato <[EMAIL PROTECTED]>:
>>>
>>>
>>>> In fact for the Beanshell interpreter (by the way... should we  consider
>>>> to
>>>> use Groovy instead of Beanshell for the use-when scripts too?) an
>>>>  undeclared
>>>> variable is void but not null.
>>>>
>>>>
>>
>

Reply via email to