This is a PHP question but is probably applicable to other languages.
Which is a better way to handle variable assignments?
// Use default value and overwrite
$var_one = 'x';
if ($var_two) {
$var_one = 'y';
}
// Use complete if/else
if ($var_two) {
$var_one = 'y';
} else {
$var_one = 'x';
}
I'm always curious about how software works at the lowest levels.
Aucun commentaire:
Enregistrer un commentaire