I have seen lot of questions like
- Which is faster "If (bool) {true} else {false}" or "bool ? true : false"? Why? In every languages?
- Is the ternary operator faster than an "if" condition
- Which "if" construct is faster - statement or ternary operator?
But my question is which of the below is faster? From what little experience I have I assume both are same. Am I right?
if (boolVar) { }
else {
// code here
}
or
if(!boolVar) {
// code here
}
Aucun commentaire:
Enregistrer un commentaire