Question
it is ok to put an If-else statement inside if-else statement?
Of course!
Note that using proper indenting and bracketing will help you to keep track of how deep you are and which parts of the loop end.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
if (conditionA)
{
//Do something
if (condtionB)
{
//Do something
}
else
{
//Do something
}
//Do something
}
else
{
//Do something
if (conditionC)
{
//Do something
}
else if (conditionD)
{
//Do something
}
else
{
//Do something
}
// Do something
}
|
Last edited on
Topic archived. No new replies allowed.