[Tutor] trouble with function-- trying to check

Kent Johnson kent37 at tds.net
Thu Mar 15 11:25:54 CET 2007


Isaac wrote:
> In 5.9 of the Language Reference it says:
> 
> "Comparisons can be chained arbitrarily, e.g., |x < y <= z| is 
> equivalent to |x < y and y <= z"
> 
> |So this would mean that
> 
> item == item in word2
> 
> means:
> 
> item == item and item in word2
> 
> not
> 
> (item == item) and (item in word2)
> 
> which would first return each value in parentheses and place each value 
> on either side of the boolean operator [ and ]

What do you think your expression does? Since 'and' has a lower 
precedence than == and 'in', the two expressions have the same meaning. 
I added the parentheses for emphasis.

Kent



More information about the Tutor mailing list