I'm working in C# using Visual Studio and have been going over my code trying to improve its readability. I came across this site, that lists 15 best practices. #7 - Avoid Deep Nesting, it talks about If statements and says instead of using Else, make another If statement.
This got me wondering about the difference in the instructions between the two. Would using additional If statements cost more performance than just using Else?
Example:
if(condition)
{
actions;
}
else
{
actions;
}
OR
if(condition)
{
actions;
}
if(condtion)
{
actions
}
Any advice would be appreciated
Aucun commentaire:
Enregistrer un commentaire