Nested Conditional Statements

By: Dusty Arlia
Published on October 31, 2012
Last Updated on Sunday, July 12, 2015 at 3:12 PM
Total Updates: 5

A conditional statement is a statement which asks a question, and based on the answer, your program does one of two things. A nested conditional statement is a conditional statement inside another conditional statement. They are equivalent to follow-up questions. Based on the answer to the first question, will decide what question your program asks next. Here is an example:

if (bossIsInToday == 'yes') {
    if (mood == 'good') {
    //ask for a raise
    if (mood == 'bad' {
    //avoid boss at all costs