[Haskell-cafe] Is there a null statement that does nothing?

michael rice nowgate at yahoo.com
Wed Oct 21 20:43:47 EDT 2009


It looks like both the THEN and the ELSE in an IF expression must each have an expression. What's a graceful way to do nothing in either or both slots, kind of like the Fortran CONTINUE statement.

  --mr

================

[michael at localhost ~]$ ghci
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> if (1==1) then else

<interactive>:1:15: parse error on input `else'
Prelude> if (1==1) then True else

<interactive>:1:24: parse error (possibly incorrect indentation)
Prelude> if (1==1) then True else False
True
Prelude> 




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091021/2a2346c2/attachment.html


More information about the Haskell-Cafe mailing list