+ 3

What is nested if ?

how can it work

11th Mar 2017, 3:09 AM
Verma Shavneel
Verma Shavneel - avatar
3 odpowiedzi
+ 15
if() { if() { if() { if() {} } } } this is called nested if i.e.,if within if condition
11th Mar 2017, 4:17 PM
Mansi Dagla
Mansi Dagla - avatar
+ 2
if inside if
11th Mar 2017, 3:28 AM
Meharban Singh
Meharban Singh - avatar
+ 1
it works by checking the condition of the first if, and if true enters the code block, which can have its own (nested) ifs inside, can go as deep as it needs to, 3-4 nested ifs are quite common, however try not to get too many levels deep with nested ifs, makes the code much harder to read
11th Mar 2017, 3:32 AM
William La Flamme
William La Flamme - avatar