A conditional statement is a type of programming construct that allows programmers to specify one or more conditions and then specify a block of code that will be executed if those conditions are met.

The basic syntax of a conditional statement is an if keyword followed by the condition to be evaluated and then a block of code to be executed if the condition is true. There could be multiple conditions for which we use the keywords, such as if-else, if-elif-else, etc. Depending on the programming language, the syntax of the statement might have different forms, but the general idea is the same.

Get hands-on with 1200+ tech skills courses.