Code branching with IF statements

Code can be branched with the use of if statements. If statement has one or more conditional statements. If it has more than one conditional statement than it is possible to specify which condition needs to applied to it. It can be AND, OR. This condition can be negated. There could be more than one additional condition, but each additional condition will make if statement more complicated.

That code of the IF statement will be executed, where the condition is evaluated to true. There maybe additional conditions that will evaluate to true, however these will be ignored, because the condition was already satisfied. Only the first expression that is evaluated to TRUE will be used.

More complex conditional statements can be made with PHP's keyword case. Other programming languages may use different name for this keyword.

On flowchart diagram IF statements are represented with the rhombus.

Comments

Popular posts from this blog

Absolute and relative path in HTML pages

Errors

goto PHP operator