ZVON > References > Haskell reference
| Indexes | >> Syntax << | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Name conditional expression
Description the expression returns the value of exp2, if the value of exp1 is True. If the value of exp1 is False, it returns exp3.
Related:
Bibliography: Case Expressions [ A Gentle Introduction to Haskell ]

Example 1

Input: if True then 1 else 2

Output: 1

Example 2

Input: if False then 1 else 2

Output: 2

Example 3

Input: if 2>1 then "OK" else "False"

Output: "OK"