Conditional Programming is programming involving the use of boolean conditions (TRUE or FALSE) to direct the flow of a program.
Let’s consider a case, how would you program a LED if I want you to turn the LED only when a switch connected to digital pin 2 is pressed otherwise it is turned Off? Got it! you have to check the state of the switch and execute a certain code when it is pressed and another when it is not pressed.
This is known as conditional programming.
Before diving into deep, we have to clear some concepts. In this lesson, we will first learn about various operators, if-else-if statement and later on, using these concepts, we will program the above-stated problem.
Let’s get started.