Science Fair Project Encyclopedia
Guard statement
A conditional statement in Haskell or Clean whose right-hand side will only be evaluated if the guard statement evaluates to true. A list of guard statements are normally evaluated in a top to bottom order.
f x | x > 0 = 1 | otherwise = 0
The guard statements occur after each "|" and before the "=".
Similar to the mathematic notation:
In this case the guard conditions are the "if" and "otherwise" statements.
09-23-2007 01:00:40
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details


