Inverted syntax: Difference between revisions
Content added Content deleted
(→{{header|Lua}}: added Lua solution) |
(→{{header|Haskell}}: Added a Data.Bool.bool example.) |
||
Line 523: | Line 523: | ||
let y = a * b in |
let y = a * b in |
||
(x + y) / y</lang> |
(x + y) / y</lang> |
||
---- |
|||
The standard ''Data.Bool'' module defines a ''bool'' function. |
|||
'''bool x y p''' evaluates to '''x''' when '''p''' is '''False''', and evaluates to '''y''' when '''p''' is '''True'''. |
|||
<lang haskell>import Data.Bool (bool) |
|||
main :: IO () |
|||
main = |
|||
let raining = False |
|||
in putStrLn $ bool "No need" "UMBRELLA !" raining</lang> |
|||
{{Out}} |
|||
<pre>No need</pre> |
|||
=={{header|Icon}} and {{header|Unicon}}== |
=={{header|Icon}} and {{header|Unicon}}== |