[Haskell] a quick question
Julian Gilbey
julian at d-and-j.net
Thu Feb 3 08:57:38 CET 2011
On Wed, Feb 02, 2011 at 10:01:08PM -0500, Ramy Abdel-Azim wrote:
> No need to apologize. Not dumb of you. The mandatory else is unusual. I
> don't personally know of any other language that requires an else for every
> if.
Indeed. Haskell's if ... then ... else ... is akin to C's ... ? ... :
... ternary operator rather than standard if/then/else clauses.
Remember that if ... then ... else ... is an _expression_, so must
have a value irrespective of whether the condition is true or false;
therefore, there must be an else clause.
Julian
More information about the Haskell
mailing list