[Rio-pm] Chaves de hash

Renato Santos renato.cron em gmail.com
Quinta Novembro 29 16:13:46 PST 2012


use && sempre e seja feliz, só use and quando você souber oque está fazendo.

o 'and' é praticamente o 'e' da nossa lingua, vc diz pro seu codigo 'faça
isso, e isso', ele não é de comparação, embora faça isso também.

On Thu, Nov 29, 2012 at 10:09 PM, Bruno Buss <bruno.buss em gmail.com> wrote:

>
>
> 2012/11/29 <thiagoglauco em ticursos.net>
>
> Seu primeiro erro é o operador and. No documento perlop: $ perldoc perlop
>> você vai descobrir o seguinte:
>>
>>  " Logical And
>>      Binary "and" returns the logical conjunction of the two
>>      surrounding expressions.  It's equivalent to && except for
>>      the very low precedence.  This means that it short-circuits:
>>      i.e., the right expression is evaluated only if the left
>>      expression is true.
>> [...]
>>   C-style Logical And
>>      Binary "&&" performs a short-circuit logical AND operation.
>>      That is, if the left operand is false, the right operand is
>>      not even evaluated.  Scalar or list context propagates down
>>      to the right operand if it is evaluated."
>>
>> Logo, seu código
>>
>>
>> if($keys >= $min and $keys <= $max){
>>
>> deveria ser if($keys >= $min && $keys <= $max){
>>
>
> Eu devo ser muito estúpido... mas alguém que está falando isso (ja é o
> 3o), poderia fazer o favor de me explicar porque ele deve usar && no lugar
> do 'and' e qual diferença isso faz no caso deste if específico? E em quais
> situações deve-se usar o 'and' no lugar de &&?
>
> [ ]'s
> --
> Bruno C. Buss
> http://www.brunobuss.net
>
> _______________________________________________
> Rio-pm mailing list
> Rio-pm em pm.org
> http://mail.pm.org/mailman/listinfo/rio-pm
>



-- 
Saravá,
Renato CRON
http://www.renatocron.com/blog/
@renato_cron <http://twitter.com/#!/renato_cron>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/rio-pm/attachments/20121129/5dc9c335/attachment-0001.html>


Mais detalhes sobre a lista de discussão Rio-pm