Well, well well look who is getting into programming! Let me explain a little about the "if else" statements in programming languages for some of us who do not have any background in programming. When you are writing a code, you need to account for all possible situations and conditions. You are building your logic for what if this happens, what if that happens! So the widely followed syntax is
If (a happens)
{Do B}
Else
{Do C}
To make it a little more complex
If ( A happens)
{Do B}
Else If (C happens)
{Do C}
Else
{Do D}
Hmmm.. Interesting! Are we not following a big big "If Else" code in our lives!! Its a built in code that determines everything in life!
For example : If I am hungry, I eat else I do not eat
or If you hit me , I will be hurt else (I will hit you back!!)
or If this happens , I am in good mood else .....
Wow! This is amazing.. Now that I am looking at everything as If else code, I have tons and tons of examples!
I love this concept of applying If else to everything!
If (a happens)
{Do B}
Else
{Do C}
To make it a little more complex
If ( A happens)
{Do B}
Else If (C happens)
{Do C}
Else
{Do D}
Hmmm.. Interesting! Are we not following a big big "If Else" code in our lives!! Its a built in code that determines everything in life!
For example : If I am hungry, I eat else I do not eat
or If you hit me , I will be hurt else (I will hit you back!!)
or If this happens , I am in good mood else .....
Wow! This is amazing.. Now that I am looking at everything as If else code, I have tons and tons of examples!
I love this concept of applying If else to everything!
No comments:
Post a Comment