meevee98 / PNP

PNP is not Pseudocode
MIT License
0 stars 0 forks source link

Implement semantic of if statement #11

Open meevee98 opened 4 years ago

meevee98 commented 4 years ago

If is one of the control flow statements that which perform different computations depending on the value of the given Boolean condition.

This is the syntax of the if statement in the PNP language:

se <condition> entao
    <block of instructions when the condition is true>
senao
    <block of instructions when the condition is false>
fim

The else branch can be omitted. An if statement can have multiple branches. Each branch can only be computed if its respective condition value is true and all the other branches won't be computed.

se <condition-1> entao
    <block of instructions when the condition-1 is true>
senao se <condition-2> entao
    <block of instructions when only the condition-2 is true>
senao se <condition-3> entao
    <block of instructions when only the condition-3 is true>
senao
    <block of instructions when all conditions are false>
fim