[Haskell-cafe] commenting out a line of code

Norbert Melzer timmelzer at gmail.com
Tue Nov 15 12:31:10 UTC 2016


I'm not quite sure, but I'd guess either one of

1.) It does not compile at all because of suspicious indentation
2.) It will just print "A" but not "done" because that is considered beeing
in the else-branch.

Johannes Waldmann <johannes.waldmann at htwk-leipzig.de> schrieb am Di., 15.
Nov. 2016 um 13:11 Uhr:

> 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.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161115/f579f20b/attachment.html>


More information about the Haskell-Cafe mailing list