[Rio-pm] Chaves de hash
Bruno Buss
bruno.buss em gmail.com
Quinta Novembro 29 16:09:16 PST 2012
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
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/rio-pm/attachments/20121129/19d60775/attachment.html>
Mais detalhes sobre a lista de discussão Rio-pm