Nested If Else Statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Nested If Else Statement

https://code.sololearn.com/c3OkUXA9wlxJ/?ref=app When I change int value to 0 in this code the else statement print Error and when I change it like 1 2 4 34 any number it says too young. I know about this topic but please help me how error statement shows as output when I set INT vakue to 0.

5th Jan 2018, 8:08 AM
Robin
Robin - avatar
2 Answers
+ 1
if age > 0 stuff displays, else there is an error. 0 > 0 is false, so the else executes
5th Jan 2018, 8:10 AM
Dan Walker
Dan Walker - avatar
0
but why not too young else statement execute why the last else statement execute?
5th Jan 2018, 8:23 AM
Robin
Robin - avatar