Frage

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.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top