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 <[email protected]> wrote: > > > 2012/11/29 <[email protected]> > > 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 > [email protected] > http://mail.pm.org/mailman/listinfo/rio-pm > -- Saravá, Renato CRON http://www.renatocron.com/blog/ @renato_cron <http://twitter.com/#!/renato_cron>
_______________________________________________ Rio-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/rio-pm
