If Statement
Home Courses Community Support
If Statement

As you learn in Logical Operator that condition making is an essential part of programming. Now we will work on it further by using decision making statements.

If statement execute if the condition is true. To write a program for it we need a situation. Check below written situation and the code for that.

Before going to office, Mr. Monu used to go temple on every Tuesday. So if it is Tuesday, print "Mr. Monu will go to temple first."

$day = "Tue";  //Tue stands for Tuesday
if ($day == "Tue"){
echo "Mr. Monu will go to temple first.";


Mr. Monu will go to temple first.


In the above code, we set the value of day to Tuesday and use if statement to check the condition. The condition was true so it print the output, "Mr. Monu will got to temple first." It will be more clear in If else statement.



← Preview

Ternary Operator

Next →

If Else Statement


Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.


  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App