On Fri, May 10, 2013 at 2:40 AM, Roland Mainz <[email protected]> wrote:
> On Fri, May 10, 2013 at 2:36 AM, David Korn <[email protected]> wrote:
>> cc:  [email protected]
>> Subject: Re: Re: [ast-developers] bool type not documented
>> --------
>>
>>> Erm... one thing which may need documentation is that "bool" returns
>>> the strings "true" and "false" when used as string but |1| and |0|
>>> when used as arithmetic expression.
>>> Otherwise this _may_ cause some confusion...
>>
>> In general the numerical value of an enumeration variable is the index
>> in the array of enumeration variables, starting at zero.
>
> Right... but it may still be confusing for people not familiar with
> all of ksh93's finer details may trip over the following issue:
> bool b=true ; $b ; print $? # returns 0
> bool b ; b=true ; print $((b)) # returns 1
> bool b ; b=false ; print $((b)) # returns 0
> bool b=false ; $b ; print $? # returns 1

What's the preferred form to use a bool for a plain *if* construct?
bool conditional ... if $conditional ; then
bool conditional ... if [[ $conditional == "true" ]] ; then
bool conditional ... if ((conditional)) ; then

Irek
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to