Yes, placing an if inside an else is a good practice, but in most cases using an else if is clearer and cleaner. For instance.
if (test) { // Do something } else if (otherTest) { // Do something else } else { // Do a third thing }
infact is short for
if (test) { // Do something } else { if (otherTest) { // Do something else } else { // Do a third thing } }
and in most cases they should compile almost identical programs.
Your sample code is not very clear and will not compile correctly, a clearer code example can help us help you.
source share