Conditional structures: Difference between revisions
Content deleted Content added
→{{header|PureBasic}}: Adding Prolog. |
Added Axe |
||
Line 398: | Line 398: | ||
There is also the ternary conditional: |
There is also the ternary conditional: |
||
<lang awk>i=(i<0? 0: 42)</lang> |
<lang awk>i=(i<0? 0: 42)</lang> |
||
=={{header|Axe}}== |
|||
Expressions that evaluate to zero are considered false. Expressions that evaluate to nonzero are considered true. |
|||
===Simple=== |
|||
<lang axe>If 1 |
|||
YEP() |
|||
End</lang> |
|||
===Inverse If=== |
|||
<lang axe>!If 1 |
|||
NOPE() |
|||
End</lang> |
|||
===If-Else=== |
|||
<lang axe>If 1 |
|||
YEP() |
|||
Else |
|||
NOPE() |
|||
End</lang> |
|||
Axe has no support for switch-like statements. If-ElseIf-Else structures are required to achieve the same goal. |
|||
===If-ElseIf-Else=== |
|||
<lang axe>If 1=0 |
|||
NOPE() |
|||
ElseIf 1=1 |
|||
YEP() |
|||
Else |
|||
NOPE() |
|||
End</lang> |
|||
===If-InverseElseIf-Else=== |
|||
<lang axe>If 1=0 |
|||
NOPE() |
|||
Else!If 1=2 |
|||
YEP() |
|||
Else |
|||
NOPE() |
|||
End</lang> |
|||
=={{header|Babel}}== |
=={{header|Babel}}== |