What is Conditional Logic in Programming?
Every programming language comes with the ability to use conditional logic.
To put it simply, applications frequently use if
and else
statements.
There are unlimited possibilities with this simple concept.
Basic example of conditional logic in websites
Suppose you have two different footer styles for your website. With a different footer layout on your website’s homepage.
You could use conditional logic to achieve this. Using your language of choice, you would write something that translates to:
if: page = homepage
render "homepage-footer"
else:
render "default-footer"
endif
Basic example of conditional logic in an application
if: user = (loggedin)
render "account-page"
else:
render "login-page"
endif