Pergunta

If I want to ensure that an if statement only executes if BOTH of two conditions are true, should I be using & or && between the clauses of the statement?

For example, should I use

if a == 5 & b == 4

or

if a == 5 && b == 4

I understand that the former is elementwise and the latter is capable of short-circuiting but am not clear on what this means.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top