Is there a noticeable difference in performance/code quality if you use a string to compare at the start of an "if" instead of a boolean?
Example with string:
string isTrue = "true";
if (isTrue == "true"){
// do something
}
Example with bool:
bool isTrue = true;
if (isTrue){
//do something
}
I generally use a bool for these kind of comparisons but I've seen both variations online.
Aucun commentaire:
Enregistrer un commentaire