[Haskell-cafe] commenting out a line of code

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Tue Nov 15 12:01:35 UTC 2016


Dear Cafe -

Sometimes, a comment can change the meaning of a program.
No? Well, but "commenting out" a line of code certainly does.
So, can you guess what this program will output?

main = do
  if True
    then do
      putStrLn "A"
    else do
      -- putStrLn "B"
  putStrLn "done"

I nominate this for inclusion in a hypothetical
Haskell equivalent of http://www.javapuzzlers.com/

- J.


More information about the Haskell-Cafe mailing list